Page tree scan
Page tree scan
Walks a repo’s Markdown files and Rust doc comments into the page tree
POST /api/pages/push expects (docs/api.md, src/content_push.rs in
the Storefront repo): one page per file, directories collapsed into
their README.md / index.md, and a synthetic page where neither
exists so every parent_external_id resolves.
MAX_PAGES
pub const MAX_PAGES : usize = 2000;
MAX_PUSH_ROWS in src/content_push.rs of the Storefront repo. A split
across calls would break prune, so going over this is an error rather
than a silent chunking.
ScanOutput
pub struct ScanOutput { pub pages : Vec < Page >, pub link_warnings : Vec < LinkWarning >, pub media_refs : Vec < MediaReference >, pub diagram_renders : Vec < RenderedDiagram >, # [doc = " Pages whose title is just the raw file stem or directory name; `--strict`"] # [doc = " fails on these."] pub title_warnings : Vec < String >, }
The result of a scan: the page tree, any relative-link warnings found
while rewriting links to their absolute page path, and any
references to a local non-Markdown file not present in the media_urls
passed to build_pages, left unrewritten for the caller to
upload and retry.
Page
pub struct Page { pub external_id : String, pub title : String, pub slug : String, pub path : String, pub parent_external_id : Option < String >, pub sort_order : i32, pub published : bool, pub widgets : Vec < Widget >, }
One page of the push payload. Field names and shape match
ExternalPageInput in the Storefront repo’s src/content_push.rs.
build_pages
pub fn build_pages(config : & Config, root : & Path, media_urls : & HashMap < String, String >,) -> Result < ScanOutput, ScanError >;
Builds the page tree for the repo at root, per config. Does not touch
the network itself: a caller decides whether to print it (scan) or push
it, and resolves any local non-Markdown file reference against
media_urls (repo-relative path -> uploaded media URL) before
calling; a reference not in media_urls comes back unrewritten in
ScanOutput::media_refs for the caller to upload and retry.