Expand description
Markdown formatting utilities and traits for RF-Ham output.
This crate provides two traits and a set of free formatting functions that write
coloured Markdown to any Write sink. Terminal output is styled with ANSI colours
via the colored crate; plain writers receive the same text without escape codes.
| Trait | Purpose |
|---|---|
ToMarkdown | Convert a value to Markdown without external context |
ToMarkdownWith | Convert a value to Markdown given a caller-supplied context |
Key free functions: header, plain_text, bulleted_list_item,
numbered_list_item, bold_to_string, italic_to_string, link_to_string,
fenced_code_block_start / fenced_code_block_end.
Table and Column support fixed-width columnar output.
§Examples
use rfham_markdown::{header, plain_text, bulleted_list_item};
let mut out = Vec::new();
header(&mut out, 1, "My Section").unwrap();
plain_text(&mut out, "Some content.").unwrap();
bulleted_list_item(&mut out, 1, "First item").unwrap();
let s = String::from_utf8(out).unwrap();
assert!(s.contains("My Section"));
assert!(s.contains("Some content."));Re-exports§
pub use error::MarkdownError;pub use error::MarkdownResult;
Modules§
Structs§
Enums§
Traits§
Functions§
- blank_
line - block_
quote - bold
- bold_
to_ string - bulleted_
list - bulleted_
list_ item - code
- code_
to_ string - definition_
list_ item - fenced_
code_ block_ end - fenced_
code_ block_ start - fenced_
code_ block_ start_ for - header
- header_
to_ string - italic
- italic_
to_ string - link
- link_
to_ string - numbered_
list - numbered_
list_ item - plain_
text - strikethrough
- strikethrough_
to_ string