Skip to main content

Module parser

Module parser 

Source
Expand description

Markdown → Entity parser. Handles YAML frontmatter, sections, wiki-links.

Key design decisions:

  • Hand-rolled YAML frontmatter parser (NOT serde_yaml) to match JS type coercion
  • Code blocks are masked before section/link detection to prevent false matches
  • The parser is schema-aware: it uses the schema to determine catch-all sections

Structs§

WikiLink
A wiki-link found in markdown content.

Enums§

ParseError

Functions§

compute_hash
Compute SHA-256 hash of content, truncated to 16 hex characters.
extract_inline_links_lenient
Permissive sibling of [extract_inline_links] for read-side scanners. Decodes every [[...]] token via wiki_link_to_id_lenient so on-disk drift (legacy entities, archive-imports from pre-strict engines, partial-mutation rollbacks) keeps flowing through dangling- link reporters and graph inspectors. Mutation paths MUST NOT use this helper — see [extract_inline_links] for the strict variant.
extract_wiki_links
Extract all wiki-links from markdown content.
mask_code_blocks
Mask fenced code blocks by replacing content with spaces (preserves line count and offsets). Handles unclosed code blocks safely — they mask to end of text.
parse_file
Parse an entity from a file on disk.
parse_markdown
Parse a markdown string into an Entity.
peek_title_and_type
Peek the entity title (first # heading in the body) and type (type: frontmatter field) from raw markdown without running the full schema-aware parser. Used by surfaces that read a markdown blob outside the in-memory store — e.g. memstead_diff walking git trees between two arbitrary refs, where the store snapshot (current HEAD) is not a valid source for a non-HEAD ref. Returns None for title when the body carries no # heading and None for entity_type when the frontmatter lacks a non-empty type:.
peek_type_from_frontmatter
Extract the type: value from frontmatter without running the full parser.