| 1 | # markdown-it |
| 2 | |
| 3 | This directory holds a fork of the unmaintained markdown-it-rust package. |
| 4 | Markodown forks this package to make bug fixes to its core CommonMark |
| 5 | implementation. |
| 6 | |
| 7 | Rust port of popular |
| 8 | [markdown-it.js](https://github.com/markdown-it/markdown-it) library. |
| 9 | |
| 10 | ### Features |
| 11 | |
| 12 | - 100% CommonMark compatibility |
| 13 | - AST |
| 14 | - Source maps (full support, not just on block tags like cmark) |
| 15 | - Ability to write your own syntax of arbitrary complexity |
| 16 | - to prove this point, CommonMark syntax itself is written as a plugin |
| 17 | |
| 18 | ### Usage |
| 19 | |
| 20 | ```rust |
| 21 | let parser = &mut markdown_it::MarkdownIt::new(); |
| 22 | markdown_it::plugins::cmark::add(parser); |
| 23 | markdown_it::plugins::extra::add(parser); |
| 24 | |
| 25 | let ast = parser.parse("Hello **world**!"); |
| 26 | let html = ast.render(); |
| 27 | |
| 28 | print!("{html}"); |
| 29 | // prints "<p>Hello <strong>world</strong>!</p>" |
| 30 | ``` |
| 31 | |
| 32 | For a guide on how to extend it, see `examples` folder. |