Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Markdown parsing and writing

MarkdownCodec turns stored Markdown into the editor’s blocks and spans and back. It has no UI of its own; the UI tests exercise it indirectly. Decisions: D-02, D-08, D-13.

BehaviorShared (MarkdownCodecTest)
Blocks parse into text and block types without Markdown syntax showingparsesBlocksWithoutExposingSyntax
Writing produces canonical MarkdownserializesCanonicalMarkdown
Bold, italic, strikethrough, code and links survive a round tripinlineStylesRoundTrip
Long runs of * or _ are emphasis, not literal textlongDelimiterRunsAreEmphasisNotText
Literal Markdown characters typed as text are escapedescapesLiteralMarkdownCharacters
Text that looks like a numbered item (1.) at a paragraph start is escapednumberedParagraphTextIsEscaped
Empty paragraphs between content are preservedemptyParagraphsBetweenContentArePreserved
A literal non-breaking space in text is escapedliteralNbspTextIsEscaped
Unsupported syntax (tables, horizontal rules, HTML) is kept verbatim as raw blocksunsupportedSyntaxIsPreservedVerbatim
Writing what was parsed gives the same Markdown again (fixed point)serializationIsAFixedPoint
An empty documentemptyDocument
Task items and their checked state are derivedderivesTaskItems

Related: search matches visible text, not syntax (NotesCoreTest.searchMatchesVisibleTextNotSyntax, see search.md); diffs compare visible text (see history.md).

Gaps

  • Mermaid fences (D-13: imported, shown as code, exported unchanged) have no test of their own.
  • Images and footnotes are not checked to survive a save (tables, rules and HTML are).
  • Nested lists deeper than one level and numbered-list renumbering (RichText.listNumbers) have no direct test.
  • Very large notes (parse and write time) are untested.