20 releases (13 breaking)

0.14.1 Nov 20, 2024
0.13.3 Apr 21, 2024
0.12.1 Nov 29, 2023
0.4.0 Jul 10, 2023

#434 in Text processing

Download history 1/week @ 2024-08-24 3/week @ 2024-08-31 29/week @ 2024-09-21 280/week @ 2024-09-28 34/week @ 2024-10-05 15/week @ 2024-10-12 4/week @ 2024-10-19 9/week @ 2024-10-26 45/week @ 2024-11-02 1/week @ 2024-11-09 153/week @ 2024-11-16 445/week @ 2024-11-23 122/week @ 2024-11-30

721 downloads per month

MIT/Apache

130KB
3.5K SLoC

yamd

codecov crates.io Released API docs

YAMD - Yet Another Markdown Document (flavour)

Simplified version of CommonMark.

For formatting check YAMD struct documentation.

Reasoning

Simplified set of rules allows to have simpler, more efficient, parser and renderer. YAMD does not provide render functionality, instead it is a [serde] serializable structure that allows you to write any renderer for that structure. All HTML equivalents in this doc are provided as an example to what it can be rendered.

Difference from CommonMark

Escaping

Escaping done on a [lexer] level. Every symbol following the \ symbol will be treated as a literal.

Example:

YAMD HTML equivalent
\**foo** <p>**foo**</p>

Escape character

To get \ - \\ must be used.

Example:

YAMD HTML equivalent
\\**foo** <p>\<b>foo</b></p>

Precedence

CommonMark defines container blocks and leaf blocks. And that container block indicator has higher precedence. YAMD does not discriminate by block type, every node (block) is the same. In practice, there are no additional rules to encode and remember.

Example:

YAMD HTML equivalent
- `one\n- two` <ol><li><code>one\n- two</code></li></ol>

If you want to have two ListItem's use escaping:

YAMD HTML equivalent
- \`one\n- two\` <ol><li>`one</li><li>two`</li><ol>

The reasoning is that those kind issues can be caught with tooling like linters/lsp. That tooling does not exist yet.

Nodes

List of supported nodes and their formatting slightly defers from CommonSpec.

Dependencies

~0.3–1MB
~21K SLoC