Expand description
tdoc is a toolkit for building, parsing, formatting, and exporting documents across FTML, HTML, Markdown, and Gemini.
The crate is centered around three core concepts:
Document,Paragraph, andSpan, which form an in-memory tree representation of document content.- Format modules (see [
ftml],html,markdown, andgemini) that provide both parsers and writers for each external format. - A
formatterfor rendering the tree to richly styled terminal output.
Checklists (Markdown - [ ] entries or HTML <input type="checkbox">
lists) map to ParagraphType::Checklist nodes that store ChecklistItem
children. Nested checklist items are preserved end-to-end so complex task
hierarchies round-trip across every parser and writer.
Most applications start by building a Document manually or converting
some source text via one of the format modules, manipulate or inspect the
tree, and finally render it with ftml::Writer, [html::Writer], or
formatter::Formatter.
Re-exports§
pub use document::Document;pub use inline::InlineStyle;pub use inline::Span;pub use paragraph::ChecklistItem;pub use paragraph::Paragraph;pub use paragraph::ParagraphType;pub use paragraph::TableCell;pub use paragraph::TableRow;pub use pager::*;
Modules§
- document
- Defines the
Documentroot node of the document tree. - formatter
- Render documents to formatted plain text suitable for terminals or logs.
- ftml
- Parse and emit FTML (Formatted Text Markup Language).
- gemini
- Convert between Gemini text (.gmi) and FTML
Documenttrees. - html
- Parse and emit HTML.
- inline
- Inline styling primitives used by paragraphs.
- markdown
- Convert between Markdown text and FTML
Documenttrees. - metadata
- Document metadata parsing and serialization.
- pager
- paragraph
- Paragraph primitives that make up the
Documenttree. - test_
helpers - Convenience constructors for assembling documents in tests.
Macros§
- doc
- Builds a
Documentusing tdoc’s full inline DSL. - ftml
- Builds a
Documentusing an inline DSL limited to strict FTML.
Type Aliases§
- Result
- Convenience result type used across parsing and writing APIs.