Expand description
tdoc is a toolkit for building, parsing, formatting, and exporting FTML (Formatted Text Markup Language) documents.
The crate is centered around three core concepts:
Document,Paragraph, andSpan, which form an in-memory tree representation of FTML content.- Parsers (see
parser,html,markdown, andgemini) that turn external text into that tree. - Writers and formatters (see
writerandformatter) that turn the tree back into HTML, Markdown, Gemini, or 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 parse, manipulate or inspect the tree, and finally
render it with writer::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 parser::parse;pub use writer::write;pub use pager::*;
Modules§
- document
- Defines the
Documentroot node for FTML content. - formatter
- Render documents to formatted plain text suitable for terminals or logs.
- gemini
- Convert between Gemini text (.gmi) and FTML
Documenttrees. - html
- Parse real-world HTML into the internal FTML representation.
- inline
- Inline styling primitives used by paragraphs.
- markdown
- Convert between Markdown text and FTML
Documenttrees. - pager
- paragraph
- Paragraph primitives that make up the
Documenttree. - parser
- FTML parser that transforms HTML-like markup into
Documenttrees. - test_
helpers - Convenience constructors for assembling documents in tests.
- writer
- Serialize
Documenttrees back into FTML/HTML.
Macros§
Type Aliases§
- Result
- Convenience result type used across parsing and writing APIs.