Skip to main content

ArticleFormat

Trait ArticleFormat 

Source
pub trait ArticleFormat {
    // Required methods
    fn format_plain(&self) -> String;
    fn format_json(&self) -> Result<String>;
    fn format_markdown(&self) -> String;
}
Expand description

Output formatting for a collection of ArticleItems.

Required Methods§

Source

fn format_plain(&self) -> String

Format as plain text.

Section headings are emitted as #/##/### lines. Images are rendered as [Image: alt text] followed by caption. References are omitted.

Source

fn format_json(&self) -> Result<String>

Format as a semantic JSON section tree.

Structure:

{
  "intro": ["..."], "intro_images": [...],
  "sections": [{"heading":"...","level":2,"paragraphs":[...],"images":[...],"subsections":[...]}],
  "references": {"cite_note-Foo-1": "Full citation text..."}
}
Source

fn format_markdown(&self) -> String

Format as Markdown.

Inline: bold → **text**, italic → _text_, links → [text](href), citation refs → [N]. Images → ![alt](src) with italic caption. A ## References section with [N]: citation definitions is appended when references are present.

Implementations on Foreign Types§

Source§

impl ArticleFormat for &[ArticleItem]

Source§

impl ArticleFormat for Vec<ArticleItem>

Implementors§