#markdown #ast #markdown-syntax #document #representation #transformation #pulldown-cmark

bin+lib markdown-ast

Markdown AST representation for document construction and transformation, based on pulldown-cmark

2 releases

0.1.1 Jun 19, 2024
0.1.0 Jun 19, 2024

#2826 in Parser implementations

MIT/Apache

60KB
1K SLoC

Markdown

API Documentation | Changelog | Contributing

This repository contains two projects for working with Markdown documents:

  • markdown-ast — a Rust crate modeling Markdown syntax as an AST.

  • ConnorGray/Markdown — a Wolfram paclet providing a symbolic representation of Markdown elements, and (TODO) notebook frontend support for opening and editing .md files.

Quick Examples

Parse a Markdown document into an AST in Rust:

use markdown_ast::{markdown_to_ast, Block, Inline, Inlines};

let ast = markdown_to_ast("
Hello! This is a paragraph **with bold text**.
");

assert_eq!(ast, vec![
    Block::Paragraph(Inlines(vec![
        Inline::Text("Hello! This is a paragraph ".to_owned()),
        Inline::Strong(Inlines(vec![
            Inline::Text("with bold text".to_owned()),
        ])),
        Inline::Text(".".to_owned())
    ]))
]);

File Overview

License

Licensed under either of

at your option.

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Developer Notes

See Development.md for instructions on how to perform common development tasks when contributing to this repository.

Dependencies

~2.5MB
~42K SLoC