code wiki / (root) / nx_build_doc.nx

nx_build_doc.nx

buildroot/runtime/nx_build_doc.nx

7227 B222 linesdepth 4pulls 7 transitivereach 1 importersview sourcekind librarytopic build
docsdependenciesstructsconstsfunctions

about

nx_build_doc.nx -- render a single .md document into final HTML. The atomic build unit for nx_build_site (the bits-up replacement for nishi-pages/build/build.py). Composes: nx_frontmatter -- split "---YAML---body" nx_yaml_subset -- parse the frontmatter YAML metadata nx_md_render -- markdown body -> HTML nx_http_template -- {{ var }} + {{ var | raw }} substitution Pipeline for one .md doc: 1. Read source bytes 2. Split frontmatter -> (yaml_bytes, body_bytes) 3. Parse yaml metadata into NxYamlDoc (title, date, layout, etc.) 4. Render markdown body -> body_html 5. Apply inner template (post.html or page.html) substituting page.title, page.date, page.author, body (raw) 6. Apply outer layout (layout.html) substituting site.*, page.*, content (raw) where content = inner template output 7. Caller writes the final HTML wherever it wants nx_safety_envelope: intended_use: render one md doc end-to-end for nx_build_site sil_target: SIL2 evidence: bench/nx_build_doc_smoke.nx round-trips a known fixture and asserts the output bytes contain the expected substituted values verdict: NOT_YET_EVALUATED -- pending smoke

dependencies 4 imports · 1 importers

nx_syscalls_x86_64.nx nx_yaml_subset.nx nx_frontmatter.nx nx_http_template.nx nx_build_doc.nx nx_build_site.nx

imports: nx_syscalls_x86_64.nxnx_yaml_subset.nxnx_frontmatter.nxnx_http_template.nx

imported by: nx_build_site.nx

structs

91struct NxBuildVars

consts

37const NX_BUILD_DOC_OK: i64 = 0
38const NX_BUILD_DOC_BAD_INPUT: i64 = 1
39const NX_BUILD_DOC_FRONTMATTER_FAIL: i64 = 2
40const NX_BUILD_DOC_YAML_FAIL: i64 = 3
41const NX_BUILD_DOC_INNER_TMPL_FAIL: i64 = 4
42const NX_BUILD_DOC_OUTER_TMPL_FAIL: i64 = 5
43const NX_BUILD_DOC_OUT_TOO_SMALL: i64 = 6
44const NX_BUILD_DOC_VERDICT_N: i64 = 7
87const NX_BD_MAX_VARS: i64 = 16
88const NX_BD_NAMES_CAP: i64 = 512
89const NX_BD_VALUES_CAP: i64 = 16384 // 16K for body html
103const NX_BUILD_VARS_BYTES: i64 = 72

functions

48func _bd_bcopy(dst: *u8, src: *u8, n: i64) -> i64
54func _bd_strlen(s: *u8, cap: i64) -> i64
64func _bd_append(dst: *u8, off: i64, cap: i64,
106func nx_build_vars_init(bv: *NxBuildVars) -> i64
121func nx_build_vars_add(bv: *NxBuildVars,
163func nx_build_vars_seal(bv: *NxBuildVars) -> i64
176func nx_build_vars_add_yaml(bv: *NxBuildVars,
215func nx_build_apply_template(tmpl: *u8, tmpl_n: i64,