Skip to main content

Module serialize

Module serialize 

Source
Expand description

Doc → markdown.

The guarantee is a fixed point: parse(serialize(parse(s))) equals parse(s) for any input. An edit/save cycle can therefore never drift, which is the property an editor actually needs — stronger than pretty output and weaker (honestly so) than byte-identical round tripping, which a flat model cannot promise for arbitrarily nested CommonMark.

Escaping is deliberately narrow. Over-escaping is its own bug: escaping # everywhere turns a #123 reference into \#123, which no reader matches. So #, >, - and friends are escaped only at the start of a line, where they would actually mean something.

Functions§

serialize
serialize_at
The document as markdown, and where at landed in it.
serialize_with
serialize with the app’s own marks — see crate::Marks.