code wiki / (root) / nx_md_render.nx

nx_md_render.nx

buildroot/runtime/nx_md_render.nx

19011 B442 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_md_render.nx -- sovereign Markdown -> HTML renderer. Single-pass. Scan input bytes line-by-line; emit HTML bytes. CommonMark subset suitable for andelinwest.com and similar human-written content: # Heading -> <h1>Heading</h1> ## Heading 2 -> <h2>Heading 2</h2> ... up to ###### normal paragraph -> <p>normal paragraph</p> - list item -> <ul><li>list item</li>...</ul> *italic* -> <em>italic</em> **bold** -> <strong>bold</strong> `code` -> <code>code</code> [text](url) -> <a href="url">text</a> --- -> <hr /> blank line -> closes the current paragraph or list ``` -> toggle pre-formatted code block Not yet supported (named improvement, queued L10b): tables, blockquotes, ordered lists, nested lists, images, footnotes, reference links, HTML pass-through. These mostly compose by adding one more transition state to the scanner; the substrate stays the same shape. Escaping: <, >, &, " in input bytes are emitted as &lt; &gt; &amp; &quot; in output (skipping HTML pass-through for safety). genealogy_id: commonmark_0_30 + cmark_2014 + markdown_perl_2004 lineage_id: nishi_markdown_subset_q10

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_md_render.nx nx_build_site.nx

imports: nx_syscalls.nx

imported by: nx_build_site.nx

structs

none

consts

217const NX_MD_STATE_NONE: i64 = 0
218const NX_MD_STATE_PARA: i64 = 1
219const NX_MD_STATE_LIST: i64 = 2
220const NX_MD_STATE_CODE: i64 = 3

functions

43func _emit1(out: *u8, off: i64, b: i64) -> i64
called by 1: nx_md_render
49func _emitn(out: *u8, off: i64, src: *u8, n: i64) -> i64
58func _emit_esc1(out: *u8, off: i64, b: i64) -> i64
81func _emit_inline(out: *u8, off_in: i64, src: *u8, n: i64) -> i64
called by 1: nx_md_render calls 1: _emit_esc1
223func _close_block(out: *u8, off_in: i64, state: i64) -> i64
called by 1: nx_md_render
244func nx_md_render(src: *u8, n: i64, out: *u8) -> i64