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
Re-exports§
pub use crate::markdown::mask_code_blocks;pub use crate::markdown::mask_code_blocks_and_spans;
Enums§
- Frontmatter
- What a document’s leading
---block turned out to be. - Parse
Error
Functions§
- body_
after_ frontmatter - Return the body slice after a leading
---frontmatter block, or the whole input when no frontmatter is present. Mirrors the offset arithmetic in [split_frontmatter] but borrows rather than allocating — a scan needs to read, not own. - 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 viawiki_link_to_id_lenientso 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. - frontmatter_
parts - The frontmatter block and the body of a document, both borrowed, or
Nonewhen the document carries no closed frontmatter (no opening fence on its first line, or an opening fence never closed). The one entry point every reader outside this module uses; the contract issplit_frontmatter_core’s: a byte-order mark is skipped, CRLF and LF documents both split, the fence counts only at the start of the document, and the body starts after the closing fence’s line break. - has_
merge_ conflict_ markers - True when
text— a whole entity file — carries a complete git merge-conflict block: an ordered<<<<<<< …/=======/>>>>>>> …triple at line starts. - 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_diffwalking git trees between two arbitrary refs, where the store snapshot (current HEAD) is not a valid source for a non-HEAD ref. ReturnsNonefortitlewhen the body carries no#heading andNoneforentity_typewhen the frontmatter lacks a non-emptytype:. - peek_
type_ from_ frontmatter - Extract the
type:value from frontmatter without running the full parser. - split_
frontmatter_ core - Split a document at its frontmatter delimiters.