diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-09-26 16:12:25 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-09-26 16:12:25 +0200 |
commit | a0c84c505d733be2e987a333a34244c1befb56cb (patch) | |
tree | 0545a747b6f2f627a71bd31949ad622bbc56c176 /readme.md | |
parent | 9cb9e37c33173c16cbafd345f43e43b5a550537d (diff) | |
download | markdown-rs-a0c84c505d733be2e987a333a34244c1befb56cb.tar.gz markdown-rs-a0c84c505d733be2e987a333a34244c1befb56cb.tar.bz2 markdown-rs-a0c84c505d733be2e987a333a34244c1befb56cb.zip |
Add support for compiling to mdast
See: <https://github.com/syntax-tree/mdast>.
Diffstat (limited to 'readme.md')
-rw-r--r-- | readme.md | 97 |
1 files changed, 48 insertions, 49 deletions
@@ -22,11 +22,11 @@ positional info, concrete tokens, and extensions. - [x] **[compliant][commonmark]** (100% to CommonMark) - [x] **[extensions][]** (100% GFM, 100% MDX, frontmatter, math) +- [x] **[ast][mdast]** (mdast) - [x] **[safe][security]** (100% safe rust, also 100% safe HTML by default) - [x] **[robust][test]** (2300+ tests, 100% coverage, fuzz testing) -Itβs also `#![no_std]` + `alloc`, has tons of docs, and has a single dependency -(for optional debug logging). +Itβs also `#![no_std]` + `alloc` and has tons of docs. > π£ **Note**: coverage is currently within progress. @@ -58,7 +58,6 @@ generate syntax trees or compile to other output formats. - [Use](#use) - [API](#api) - [Extensions](#extensions) -- [Architecture](#architecture) - [Examples](#examples) - [Markdown](#markdown) - [Project](#project) @@ -128,6 +127,7 @@ Yields: `micromark` exposes [`micromark`](https://wooorm.com/micromark-rs/micromark/fn.micromark.html), [`micromark_with_options`](https://wooorm.com/micromark-rs/micromark/fn.micromark_with_options.html), and +[`micromark_to_mdast`](https://wooorm.com/micromark-rs/micromark/fn.micromark_to_mdast.html), and [`Options`](https://wooorm.com/micromark-rs/micromark/struct.Options.html). See [crate docs][docs] for more info. @@ -155,52 +155,6 @@ It is not a goal of this project to support lots of different extensions. Itβs instead a goal to support incredibly common, somewhat standardized, extensions. -## Architecture - -micromark is maintained as a single monolithic package. - -### Overview - -The process to parse markdown looks like this: - -```txt - micromark -+------------------------------------------------+ -| +-------+ +---------+ | -| -markdown->+ parse +-events->+ compile +-html- | -| +-------+ +---------+ | -+------------------------------------------------+ -``` - -### File structure - -The files in `src/` are as follows: - -- `construct/*.rs` - β CommonMark, GFM, and other extension constructs used in micromark -- `util/*.rs` - β helpers often needed when parsing markdown -- `event.rs` - β things with meaning happening somewhere -- `lib.rs` - β core module -- `mdast.rs` - β syntax tree -- `parser.rs` - β turn a string of markdown into events -- `resolve.rs` - β steps to process events -- `state.rs` - β steps of the state machine -- `subtokenize.rs` - β handle content in other content -- `to_html.rs` - β turns events into a string of HTML -- `to_mdast.rs` - β turns events into a syntax tree -- `tokenizer.rs` - β glue the states of the state machine together - ## Examples <!-- To do: example section with more full-fledged examples, on GFM, math, frontmatter, etc. --> @@ -338,6 +292,50 @@ For more practical examples of how things roughly work in BNF, see the module do ## Project +micromark is maintained as a single monolithic package. + +### Overview + +The process to parse markdown looks like this: + +```txt + micromark ++-------------------------------------------------+ +| +-------+ +---------+--html- | +| -markdown->+ parse +-events->+ compile + | +| +-------+ +---------+-mdast- | ++-------------------------------------------------+ +``` + +### File structure + +The files in `src/` are as follows: + +- `construct/*.rs` + β CommonMark, GFM, and other extension constructs used in micromark +- `util/*.rs` + β helpers often needed when parsing markdown +- `event.rs` + β things with meaning happening somewhere +- `lib.rs` + β core module +- `mdast.rs` + β syntax tree +- `parser.rs` + β turn a string of markdown into events +- `resolve.rs` + β steps to process events +- `state.rs` + β steps of the state machine +- `subtokenize.rs` + β handle content in other content +- `to_html.rs` + β turns events into a string of HTML +- `to_mdast.rs` + β turns events into a syntax tree +- `tokenizer.rs` + β glue the states of the state machine together + ### Comparison > π§ **To do**. @@ -465,6 +463,7 @@ Support this effort and give back by sponsoring: [chalker]: https://github.com/ChALkeR [license]: https://github.com/micromark/micromark/blob/main/license [author]: https://wooorm.com +[mdast]: https://github.com/syntax-tree/mdast [starry-night]: https://github.com/wooorm/starry-night [contribute]: #contribute [sponsor]: #sponsor |