Rich text / foldkit-richtext-markdown

print

function · packages/richtext-markdown/src/print.ts:554

function print(
  document: RichText.Document,
  options?: PrintOptions,
): PrintedMarkdown

Prints a document as CommonMark with GFM's lists, tasks, strikethrough, and tables. Anything the mapping has no syntax for is reported in diagnostics; an empty document prints as an empty string, and every other one ends with a newline.

With a style, constructs are spelled as it says. Some spellings mean something else in some places — _ does not open emphasis inside a word — so the styled text is read back, and when it reads as a different document than the canonical text does, the canonical text is what prints (§138).