code wiki / (root) / nx_markdown_inline.nx

nx_markdown_inline.nx

buildroot/runtime/nx_markdown_inline.nx

8232 B235 linesdepth 3pulls 3 transitivereach 27 importersview sourcekind tooltopic markdown
docsdependenciesstructsconstsfunctions

about

markdown_inline.nx -- render inline Markdown to HTML. Inline-level only -- headings / paragraphs / lists / code blocks belong in a future markdown_block.nx that walks line- by-line and feeds each line through THIS module. Splitting inline from block keeps each module small + testable. Supported inline constructs (CommonMark ยง6, practical subset): *em* -> <em>em</em> _em_ -> <em>em</em> **strong** -> <strong>strong</strong> __strong__ -> <strong>strong</strong> `code` -> <code>code</code> [label](href) -> <a href=\"href\">label</a> HTML-unsafe characters in surrounding text (<, >, &, \", ') pass through html_escape.nx so we don't re-introduce XSS. Composes html_escape.nx. Invariants: MD1 No nested emphasis parsing today -- *outer *inner* outer* renders naively (matches emphasis greedily). MD2 Code spans (`...`) disable markup inside; their content IS html-escaped so `<script>` renders as code. MD3 Link href is NOT validated or escaped against javascript: / data: schemes. For untrusted content callers should pre-filter href before feeding us.

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_html_escape.nx nx_markdown_inline.nx markdown_inline.nx nx_markdown_block.nx

imports: nx_syscalls.nxnx_html_escape.nx

imported by: markdown_inline.nxnx_markdown_block.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap markdown_inline md_put_esc html_escape he_is_safe he_put md_put

structs

none

consts

39const MD_ERR_SHORT: i64 = -1

functions

41func md_put(out: *u8, cap: i64, off: i64, src: *u8, n: i64) -> i64
called by 1: markdown_inline
52func md_put_esc(out: *u8, cap: i64, off: i64,
called by 1: markdown_inline calls 1: html_escape
62func markdown_inline(src: *u8, n: i64, out: *u8, cap: i64) -> i64
called by 2: mb_put_inlinemain calls 2: md_put_escmd_put
196func main() -> i64