HtmlRenderer Class
Default HTML renderer for a Markdown MarkdownDocument object.
public class HtmlRenderer : TextRendererBase<HtmlRenderer>See also
- Inheritance
TextRendererBase<HtmlRenderer>HtmlRenderer
Constructors
| Name | Description |
|---|---|
| HtmlRenderer(TextWriter) | Initializes a new instance of the HtmlRenderer class. |
HtmlRenderer(TextWriter)
HtmlRenderer.csInitializes a new instance of the HtmlRenderer class.
public HtmlRenderer(TextWriter writer)Parameters
writerTextWriter- The writer.
Properties
| Name | Description |
|---|---|
| BaseUrl | Gets a value to use as the base url for all relative links |
| EnableHtmlEscape | Gets or sets the enable html escape. |
| EnableHtmlForBlock | Gets or sets a value indicating whether to output HTML tags when rendering. See remarks. |
| EnableHtmlForInline | Gets or sets a value indicating whether to output HTML tags when rendering. See remarks. |
| ImplicitParagraph | Gets or sets a value indicating whether to use implicit paragraph (optional <p>) |
| LinkRewriter | Allows links to be rewritten |
| UseNonAsciiNoEscape | Gets or sets the use non ascii no escape. |
BaseUrl
HtmlRenderer.csEnableHtmlEscape
HtmlRenderer.csEnableHtmlForBlock
HtmlRenderer.csEnableHtmlForInline
HtmlRenderer.csImplicitParagraph
HtmlRenderer.csLinkRewriter
HtmlRenderer.csAllows links to be rewritten
Property value
UseNonAsciiNoEscape
HtmlRenderer.csMethods
| Name | Description |
|---|---|
| WriteAttributes(HtmlAttributes?, Func<string, string>?) | Writes the specified HtmlAttributes. |
| WriteAttributes(MarkdownObject) | Writes the attached HtmlAttributes on the specified MarkdownObject. |
| WriteEscape(StringSlice, bool) | Writes the content escaped for HTML. |
| WriteEscape(StringSlice, bool) | Writes the content escaped for HTML. |
| WriteEscape(ReadOnlySpan<char>, bool) | Writes the content escaped for HTML. |
| WriteEscape(string?) | Writes the content escaped for HTML. |
| WriteEscape(string, int, int, bool) | Writes the content escaped for HTML. |
| WriteEscapeUrl(string?) | Writes the URL escaped for HTML. |
| WriteLeafRawLines(LeafBlock, bool, bool, bool) | Writes the lines of a LeafBlock |
WriteAttributes overloads
WriteAttributes(HtmlAttributes?, Func<string, string>?)
HtmlRenderer.csWrites the specified HtmlAttributes.
public HtmlRenderer WriteAttributes(HtmlAttributes? attributes, Func<string, string>? classFilter = null)Parameters
attributesHtmlAttributes?- The attributes to render.
classFilterFunc<string, string>?- A class filter used to transform a class into another class at writing time
Returns
HtmlRenderer This instance
WriteAttributes(MarkdownObject)
HtmlRenderer.csWrites the attached HtmlAttributes on the specified MarkdownObject.
public HtmlRenderer WriteAttributes(MarkdownObject markdownObject)WriteEscape overloads
WriteEscape(StringSlice, bool)
HtmlRenderer.csWrites the content escaped for HTML.
public HtmlRenderer WriteEscape(StringSlice slice, bool softEscape = false)Parameters
sliceStringSlice- The slice.
softEscapebool- Only escape < and &
Returns
HtmlRenderer This instance
WriteEscape(StringSlice, bool)
HtmlRenderer.csWrites the content escaped for HTML.
public HtmlRenderer WriteEscape(ref StringSlice slice, bool softEscape = false)Parameters
sliceStringSlice- The slice.
softEscapebool- Only escape < and &
Returns
HtmlRenderer This instance
WriteEscape(ReadOnlySpan<char>, bool)
HtmlRenderer.csWrites the content escaped for HTML.
public void WriteEscape(ReadOnlySpan<char> content, bool softEscape = false)Parameters
contentReadOnlySpan<char>- The content.
softEscapebool- Only escape < and &
WriteEscape(string?)
HtmlRenderer.csWrites the content escaped for HTML.
public HtmlRenderer WriteEscape(string? content)WriteEscape(string, int, int, bool)
HtmlRenderer.csWrites the content escaped for HTML.
public HtmlRenderer WriteEscape(string content, int offset, int length, bool softEscape = false)Parameters
contentstring- The content.
offsetint- The offset.
lengthint- The length.
softEscapebool- Only escape < and &
Returns
HtmlRenderer This instance
WriteEscapeUrl(string?)
HtmlRenderer.csWrites the URL escaped for HTML.
public HtmlRenderer WriteEscapeUrl(string? content)WriteLeafRawLines(LeafBlock, bool, bool, bool)
HtmlRenderer.csWrites the lines of a LeafBlock
public HtmlRenderer WriteLeafRawLines(LeafBlock leafBlock, bool writeEndOfLines, bool escape, bool softEscape = false)Parameters
leafBlockLeafBlock- The leaf block.
writeEndOfLinesbool- if set to
truewrite end of lines. escapebool- if set to
trueescape the content for HTML softEscapebool- Only escape < and &
Returns
HtmlRenderer This instance