« Back to Search  |  Reader Mode  |  Switch to Full Retro Site View Links: Stay in Reader  |  Retro Mode: ON  |  Original »
GitHub · Extracted in 1601 ms

GitHub - markdown-it-rust/markdown-it: markdown-it js library rewritten in rust

Source: https://github.com/markdown-it-rust/markdown-it

Repository navigation

markdown-it
Public

About

markdown-it js library rewritten in rust

Resources

Readme License Activity Custom properties

Stars

121 stars

Watchers

6 watching

Forks

19 forks Report repository
Branches

Tags
Go to Branches page Go to Tags page

Latest commit

 

History


172 Commits
View commit history for this file.

Folders and files

Name Name Last commit message Last commit date
.github/ workflows .github/ workflows    
benchmarks benchmarks    
demo demo    
examples/ ferris examples/ ferris    
src src    
tests tests    
.gitignore .gitignore    
CHANGELOG.md CHANGELOG.md    
Cargo.toml Cargo.toml    
LICENSE LICENSE    
README.md README.md    

Repository files navigation

markdown-it

Rust port of popular markdown-it.js library.

TL;DR:

  • if you want to get result fast , use pulldown-cmark
  • if you want to render GFM exactly like github, use comrak
  • if you want to define your own syntax (like @mentions, :emoji:, custom html classes), use this library

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

Features

  • 100% CommonMark compatibility
  • AST
  • Source maps (full support, not just on block tags like cmark)
  • Ability to write your own syntax of arbitrary complexity
    • to prove this point, CommonMark syntax itself is written as a plugin

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.

About

markdown-it js library rewritten in rust

Resources

Readme License Activity Custom properties

Stars

121 stars

Watchers

6 watching

Forks

19 forks Report repository

Releases

Packages

Used by

Contributors

Languages