Crate yamd

source
Expand description

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

While YAMD tries to utilize as much CommonMark syntax as possible, there are differences.

§Escaping

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

Example:

YAMDHTML equivalent
\**foo**<p>**foo**</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:

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

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

YAMDHTML 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. The best starting point is YAMD.

§MSRV

YAMD minimal supported Rust version is 1.80.0 due to Option::take_if usage

Modules§

Structs§

Functions§