Trait SyntaxHighlighterAdapter
trait SyntaxHighlighterAdapter: Send + Sync
Implement this adapter for creating a plugin for custom syntax highlighting of codefence blocks.
Required Methods
fn write_highlighted(self: &Self, output: &mut dyn Write, lang: Option<&str>, code: &str) -> io::Result<()>Generates a syntax highlighted HTML output.
lang: Name of the programming language (the info string of the codefence block after the initial "```" part). code: The source code to be syntax highlighted.
fn write_pre_tag(self: &Self, output: &mut dyn Write, attributes: HashMap<String, String>) -> io::Result<()>Generates the opening
<pre>tag. Some syntax highlighter libraries might include their own<pre>tag possibly with some HTML attribute pre-filled.attributes: A map of HTML attributes provided by comrak.fn write_code_tag(self: &Self, output: &mut dyn Write, attributes: HashMap<String, String>) -> io::Result<()>Generates the opening
<code>tag. Some syntax highlighter libraries might include their own<code>tag possibly with some HTML attribute pre-filled.attributes: A map of HTML attributes provided by comrak.