code_block
A fenced code block for code, tagged with language.
The fence is at least three backticks and one longer than the longest run of backticks in the
code, so code that itself contains a fence stays inside the block. The result ends with a
newline and the code keeps its own line breaks (a single trailing newline is not doubled).
Whitespace and backticks are removed from language, which must be a single word (rust,
sh, json, or empty for none).
Import
Section titled “Import”Cargo feature markdown (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
code | &str | The code to show. |
language | &str | The language tag for syntax highlighting, or "". |
Returns
Section titled “Returns”String — The fenced block, ending with a newline.
