Expand description
§mdprism — markdown ⇄ data, via a template
One compact schema (a textual DSL) defines a bidirectional mapping between a markdown document and a typed data object. From it you can validate, extract (parse → data), render (data → markdown), scaffold, and edit in-place.
See docs/structure-dsl-spec.md for the language and docs/mdprism-reference.md
for a worked example.
§Status
Implemented: schema parser (parse_schema), Schema data model,
scaffold (starter document), validate / extract (body
conformance), render (data → markdown), and in-place edit. The
jq-based query selector was dropped once corpus stats moved to SQL.
Structs§
- Field
Schema - One typed frontmatter key.
- Head
- The shared annotation head of every node: alias, cardinality, description.
- Problem
- One way a document failed to conform, addressed by the breadcrumb
path(alias chain) of the schema node that was unmet. - Schema
- A parsed schema: per-schema options, the frontmatter field schemas, and the body node tree.
- Schema
Error - A failure while parsing the DSL schema source. Carries a 1-based line/column.
- Schema
Opts - The
%-directive options. Defaults match the spec: strict ordering, strict matching, closed frontmatter.
Enums§
- Card
- Cardinality. On a list it bounds item count; on a heading/prose it is
presence.
Requiredis the bare default. - Edit
Error - A failure while editing a document in-place via [
Schema::edit]. - Field
Type - A frontmatter value type.
Regexkeeps the pattern source so the type isPartialEq/Clone; compile it on demand. - List
Style - Match
- A label: a literal the text must start with, or a regex (pattern source) the
text must match. A bare heading title is a
Literal. - Node
- A body node: a heading (with children), a list (with a per-item child schema), or a required paragraph.
- Render
Error - A failure while rendering markdown from data via [
Schema::render].
Functions§
- parse_
schema - Parse a schema from DSL source.