Home

Awesome

markdown-it

<img alt="web demo" src="https://img.shields.io/badge/demo-8da0cb?style=for-the-badge&labelColor=555555&logo=webpack&logoColor=white" height="20"> <img alt="github" src="https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20"> <img alt="docs.rs" src="https://img.shields.io/badge/docs-8da0cb?style=for-the-badge&labelColor=555555&logo=docs.rs" height="20"> <img alt="crates.io" src="https://img.shields.io/crates/v/markdown-it.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20"> <img alt="coverage" src="https://img.shields.io/codecov/c/github/markdown-it-rust/markdown-it?style=for-the-badge" height="20">

Rust port of popular markdown-it.js library.

TL;DR:

You can check a demo in your browser (it's Rust compiled into WASM).

Features

Usage

let parser = &mut markdown_it::MarkdownIt::new();
markdown_it::plugins::cmark::add(parser);
markdown_it::plugins::extra::add(parser);

let ast  = parser.parse("Hello **world**!");
let html = ast.render();

print!("{html}");
// prints "<p>Hello <strong>world</strong>!</p>"

For a guide on how to extend it, see examples folder.

Notes

This is an attempt at making a language-agnostic parser. You can probably parse AsciiDoc, reStructuredText or any other plain text format with this without too much effort. I might eventually write these as proof-of-concept.