mdman/format/
mod.rs

1use anyhow::Error;
2
3pub mod man;
4pub mod md;
5pub mod text;
6
7pub trait Formatter {
8    /// Renders the given markdown to the formatter's output.
9    fn render(&self, input: &str) -> Result<String, Error>;
10    /// Renders the start of a block of options (triggered by `{{#options}}`).
11    fn render_options_start(&self) -> &'static str;
12    /// Renders the end of a block of options (triggered by `{{/options}}`).
13    fn render_options_end(&self) -> &'static str;
14    /// Renders an option (triggered by `{{#option}}`).
15    fn render_option(&self, params: &[&str], block: &str, man_name: &str) -> Result<String, Error>;
16    /// Converts a man page reference into markdown that is appropriate for this format.
17    ///
18    /// Triggered by `{{man name section}}`.
19    fn linkify_man_to_md(&self, name: &str, section: u8) -> Result<String, Error>;
20}