(s: string): boolean s
stringreturns
boolean mdz - minimal markdown dialect for Fuz documentation.
Parses an enhanced markdown dialect with:
- inline formatting: code, bold, italic, strikethrough
- auto-detected links: external URLs (https://...) and internal paths (/path)
- markdown links: [text](url) with custom display text
- inline code in backticks (creates Code nodes; auto-linking to identifiers/modules
is handled by the rendering layer via MdzNodeView.svelte)
- paragraph breaks (double newline)
- block elements: headings, horizontal rules, code blocks
- HTML elements and Svelte components (opt-in via context)
Key constraint: preserves ALL whitespace exactly as authored, and is rendered with white-space pre or pre-wrap.
- False negatives over false positives: Strict syntax prevents accidentally interpreting plain text as formatting. When in doubt, treat as plain text. - One way to do things: Single unambiguous syntax per feature. No alternatives. - Explicit over implicit: Clear delimiters and column-0 requirements avoid ambiguity. - Simple over complete: Prefer simple parsing rules over complex edge case handling.
This is an early proof of concept with missing features and edge cases.
17 declarations
(s: string): boolean sstringboolean (text: string): MdzNode[] Parses text to an array of MdzNode.
textstringMdzNode[] MdzBaseNode typestringstartnumberendnumberMdzBoldNode type'Bold'childrenArray<MdzNode>MdzCodeblockNode type'Codeblock'langstring | nullcontentstringMdzCodeNode type'Code'contentstringMdzComponentNode type'Component'namestringchildrenArray<MdzNode>MdzElementNode type'Element'namestringchildrenArray<MdzNode>MdzHeadingNode type'Heading'level1 | 2 | 3 | 4 | 5 | 6childrenArray<MdzNode>MdzHrNode type'Hr'MdzItalicNode type'Italic'childrenArray<MdzNode>MdzLinkNode type'Link'referencestringchildrenArray<MdzNode>link_type'external' | 'internal'MdzNode MdzParagraphNode type'Paragraph'childrenArray<MdzNode>Parser for mdz format. Single-pass lexer/parser with text accumulation for efficiency. Used by mdz_parse, which should be preferred for simple usage.
constructortype new (template: string): MdzParser
templatestringparseMain parse method. Returns flat array of nodes, with paragraph nodes wrapping content between double newlines.
type (): MdzNode[]
MdzNode[]MdzStrikethroughNode type'Strikethrough'childrenArray<MdzNode>MdzTextNode type'Text'contentstring