nx_markdown_inline.nx
buildroot/runtime/nx_markdown_inline.nx
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
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
structs
| none |
consts
| 39 | const MD_ERR_SHORT: i64 = -1 |
functions
| 41 | func md_put(out: *u8, cap: i64, off: i64, src: *u8, n: i64) -> i64 called by 1: markdown_inline |
| 52 | func md_put_esc(out: *u8, cap: i64, off: i64, |
| 62 | func markdown_inline(src: *u8, n: i64, out: *u8, cap: i64) -> i64 |
| 196 | func main() -> i64 |