You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/README.md
+76-73Lines changed: 76 additions & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,21 @@
1
1
# pulldown-html-ext
2
2
3
-
A flexible Markdown to HTML renderer built on top of pulldown-cmarkwith support for custom styling, attributes, and rendering options.
3
+
A configurable Markdown to HTML renderer that extends [pulldown-cmark](https://github.com/raphlinus/pulldown-cmark). This library provides a flexible HTML rendering system with extensive configuration options, custom styling support, and attribute handling capabilities.
4
4
5
5
## Features
6
6
7
-
- Configurable HTML rendering with support for custom attributes and classes
8
-
- Extensive options for headings, links, code blocks, and other elements
9
-
- Support for external link handling (nofollow, target="_blank")
10
-
- Custom ID generation for headings
7
+
- Configurable HTML rendering with extensive options
8
+
- Custom attribute mapping for HTML elements
9
+
- Support for heading IDs and custom classes
10
+
- Customizable code block rendering
11
+
- External link handling with `nofollow` and `target="_blank"` options
12
+
- Table support with alignment controls
13
+
- Footnote rendering
14
+
- Task list support
11
15
- XHTML-style output option
12
-
- Table support with alignment
13
-
- Footnotes and task lists
14
-
- Line number support for code blocks
16
+
- Pretty printing support
15
17
16
-
## Usage
18
+
## Installation
17
19
18
20
Add this to your `Cargo.toml`:
19
21
@@ -22,89 +24,95 @@ Add this to your `Cargo.toml`:
22
24
pulldown-html-ext = "0.1.0"
23
25
```
24
26
25
-
### Basic Usage
27
+
##Quick Start
26
28
27
-
For basic markdown rendering with default options (this should yield the same output as `pulldown-cmark` rendering):
29
+
Here's a simple example of converting Markdown to HTML using default settings:
28
30
29
31
```rust
30
32
usepulldown_html_ext::{HtmlConfig, push_html};
31
33
32
-
fnmain() {
33
-
letconfig=HtmlConfig::default();
34
-
letmarkdown="# Hello\nThis is *markdown*";
35
-
lethtml=push_html(markdown, &config);
36
-
println!("{}", html);
37
-
}
34
+
letconfig=HtmlConfig::default();
35
+
letmarkdown="# Hello\nThis is *markdown*";
36
+
lethtml=push_html(markdown, &config);
38
37
```
39
38
40
-
### Custom Configuration
39
+
## Configuration
41
40
42
-
You can customize the rendering behavior:
41
+
The library provides extensive configuration options through the `HtmlConfig` struct:
You can override any of the methods from the `HtmlWriter` trait to customize the rendering of different Markdown elements. Some commonly overridden methods include:
155
-
-`start_link`/`end_link` for custom link rendering
156
-
-`start_code_block`/`end_code_block` for custom code block formatting
157
-
-`start_list`/`end_list` for custom list rendering
158
-
-`text` for custom text processing
161
+
Contributions are welcome! Please feel free to submit a Pull Request.
0 commit comments