Expand description
CommonMark syntax facts every Markdown writer in the family needs.
Each library renders its own document model, and how it styles a run is its own business. Where an emphasis delimiter may stand, and how text the document supplies — a picture’s description, a link’s target — has to be written so that it stays inside the construct it belongs to, are not: they are properties of CommonMark, and a writer that gets them wrong prints its syntax as text. This module answers those questions once so the writers cannot drift on them.
std-only, like the rest of the crate root.
Functions§
- code_
span - A code span holding
textexactly as given: CommonMark reads it back astext, every line ending in it read as one space. - emphasis_
can_ pair - Whether the
delimiter(*or_) characters oftextcan make emphasis among themselves: a run of them that can open (CommonMark §6.2: left-flanking, and for_not inside a word) followed somewhere later by a run that can close. - emphasis_
span - The part of a styled run that emphasis delimiters (
*,**,~~) can wrap, given the characters the run lands between, orNonewhen no part can. - escape_
block_ starts - Whether the text after an
&makes it a character reference (§6.2) —name;,#123;or#x1F;— which CommonMark would replace by the character it names.textwith whatever would open a block at the start of one of its lines escaped, so that prose written into a paragraph or a list item reads back as that prose. - escape_
html_ syntax textwith what a Markdown reader would take for HTML escaped: a<that can open a tag, a comment, a declaration, a processing instruction or an autolink, and a&that starts a character reference.- image
- A picture as an inline image:
. - link
- An inline link:
[label](destination), or[label](destination "title"). - link_
destination - A link or image destination, written so that CommonMark reads back exactly
url(§6.3).