code wiki / (root) / nx_frontmatter.nx

nx_frontmatter.nx

buildroot/runtime/nx_frontmatter.nx

3682 B99 linesdepth 3pulls 3 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_frontmatter.nx -- splits "---\n<yaml>\n---\n<body>" into YAML + body slices. Mirrors what nishi-pages/build/build.py load_doc() did in Python; substrate-native + bounded + auditable. Wire format (mandatory): src[0..3] == "---\n" (3 dashes + newline) src[3..yaml_end] == YAML subset bytes src[yaml_end..yaml_end+4] == "\n---" (terminator) OR "\n---\n" src[yaml_end+5..] == body bytes (markdown, plain text, anything) Returns: yaml_off / yaml_len = slice of the YAML subset block body_off / body_len = slice of the body bytes Used by: nishi-pages content/posts/*.md, content/pages/*.md (YAML front- matter + markdown body) Per cardinal feedback-defensive-at-boundaries: input must START with literal "---\n" or NX_FM_NO_FRONTMATTER returns; YAML term must be present or NX_FM_UNTERMINATED returns.

dependencies 1 imports · 2 importers

nx_syscalls_x86_64.nx nx_frontmatter.nx nx_build_doc.nx nx_build_site.nx

imports: nx_syscalls_x86_64.nx

imported by: nx_build_doc.nxnx_build_site.nx

structs

none

consts

33const NX_FM_OK: i64 = 0
34const NX_FM_BAD_INPUT: i64 = 1 // src null / len < 4
35const NX_FM_NO_FRONTMATTER: i64 = 2 // doesn't start with "---\n"
36const NX_FM_UNTERMINATED: i64 = 3 // no closing "\n---" found
37const NX_FM_VERDICT_N: i64 = 4

functions

39func _fm_match4(src: *u8, off: i64, n: i64,
54func nx_frontmatter_split(src: *u8, src_n: i64,