[−][src]Trait markdown_composer::transforms::CodeBlock
An extension trait for code block transformations.
Required methods
fn to_code_block(&self) -> String
Transforms the given text into a code block.
Example
use markdown_composer::transforms::CodeBlock; let text = "print(\"Hello world!\")"; let code_block = text.to_code_block(); assert_eq!(code_block, "```\nprint(\"Hello world!\")\n```");
fn to_code_block_with_language<S: AsRef<str>>(&self, language: S) -> String
Transforms the given text into a code block, allowing to specify the language to use for highlighting.
Example
use markdown_composer::transforms::CodeBlock; let text = "print(\"Hello world!\")"; let code_block = text.to_code_block_with_language("python"); assert_eq!(code_block, "```python\nprint(\"Hello world!\")\n```");
Implementors
impl<T> CodeBlock for T where
T: AsRef<str>,
[src]
T: AsRef<str>,