Expand description
XTXT — a plain-text document format with structure.
A dependency-free implementation of the format defined in SPEC.md. This is a port of the Go reference implementation, not a binding: it agrees with it because both are checked against the same conformance suite.
let res = xtxt::parse("# Hello\n\nworld\n");
assert_eq!(res.doc.nodes.len(), 2);
assert_eq!(res.doc.nodes[0].kind, xtxt::Kind::Heading);Structs§
- Arg
- One argument of a directive.
keyis empty for a positional argument. - Args
- A directive’s arguments, in source order.
- Block
- A structured directive as an agent sees it.
- Code
- Document
- A parsed document.
- Extraction
- The machine-facing view of a document: everything an agent needs without having to infer structure from prose.
- Field
- One
Key: valueentry in a block payload. - Fields
- A block payload read as an ordered record. Order matters: a
@chatblock’s turns are fields, and their sequence is the conversation. - Issue
- A diagnostic tied to a line of source.
- Item
- One entry in a list.
checkedisNoneunless it is a checklist item. - Link
- Media
- Node
- A single block in the document tree.
- Outline
- One heading in the table of contents.
- Parse
Result - The outcome of parsing. A document is always returned, even when
issuescontains errors — recovery is part of the format’s compatibility guarantee. - Table
- The interpreted payload of an
@tableblock. - Task
- A unit of work, from either a
@taskblock or a checklist item.
Enums§
Functions§
- extract
- Build the machine-facing view of a document.
- inline_
html - Convert inline markup to HTML, escaping everything else.
- inline_
text - Strip inline markup, for plain text and analysis.
- parse
- Parse an XTXT document. Parsing never fails: unrecognised content becomes a diagnostic, not a lost node.
- parse_
fields - Interpret a block payload as an ordered record. Lines before the first field become the empty key, so nothing is lost.
- parse_
table - render_
html - Render a document to an HTML fragment.
- sort_
issues - Order issues by line for stable reporting.
- source_
of - Reconstruct a directive’s source, for round-tripping and for showing unknown directives.
- validate
- Semantic checks with no plugin-declared directives.
- validate_
with - Semantic checks on top of the parser’s syntactic ones.