CodeBlockRenderer Class
An HTML renderer for a CodeBlock and FencedCodeBlock.
public class CodeBlockRenderer : HtmlObjectRenderer<CodeBlock>See also
- Inheritance
HtmlObjectRenderer<CodeBlock>CodeBlockRenderer
Constructors
| Name | Description |
|---|---|
| CodeBlockRenderer() | Initializes a new instance of the CodeBlockRenderer class. |
CodeBlockRenderer()
CodeBlockRenderer.csInitializes a new instance of the CodeBlockRenderer class.
public CodeBlockRenderer()Properties
| Name | Description |
|---|---|
| BlockMapping | Gets a map of custom block mapping to render as custom blocks instead of pre/code blocks. For example defining {"mermaid", "pre"} will render a block with info `mermaid` as a `pre` block but without the code HTML element. |
| BlocksAsDiv | Gets a map of fenced code block infos that should be rendered as div blocks instead of pre/code blocks. |
| OutputAttributesOnPre | Gets or sets the output attributes on pre. |
BlockMapping
CodeBlockRenderer.csGets a map of custom block mapping to render as custom blocks instead of pre/code blocks. For example defining {"mermaid", "pre"} will render a block with info `mermaid` as a `pre` block but without the code HTML element.
public Dictionary<string, string> BlockMapping { get; }Property value
BlocksAsDiv
CodeBlockRenderer.csGets a map of fenced code block infos that should be rendered as div blocks instead of pre/code blocks.
Property value
OutputAttributesOnPre
CodeBlockRenderer.csMethods
| Name | Description |
|---|---|
| Write(HtmlRenderer, CodeBlock) | Writes the object to the specified renderer. |
Write(HtmlRenderer, CodeBlock)
CodeBlockRenderer.csWrites the object to the specified renderer.
protected override void Write(HtmlRenderer renderer, CodeBlock obj)Parameters
rendererHtmlRendererobjCodeBlock