Skip to main content

Crate tdoc

Crate tdoc 

Source
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, and Span, which form an in-memory tree representation of document content.
  • Format modules (see [ftml], html, markdown, and gemini) that provide both parsers and writers for each external format.
  • A formatter for 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 Document root 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 Document trees.
html
Parse and emit HTML.
inline
Inline styling primitives used by paragraphs.
markdown
Convert between Markdown text and FTML Document trees.
metadata
Document metadata parsing and serialization.
pager
paragraph
Paragraph primitives that make up the Document tree.
test_helpers
Convenience constructors for assembling documents in tests.

Macros§

doc
Builds a Document using tdoc’s full inline DSL.
ftml
Builds a Document using an inline DSL limited to strict FTML.

Type Aliases§

Result
Convenience result type used across parsing and writing APIs.