MarkdownCodeBlockSyntax Class
A fenced code block (between ``` or ~~~) or an indented code block.
public sealed class MarkdownCodeBlockSyntax : MarkdownBlockSyntax- Inheritance
MarkdownBlockSyntaxMarkdownCodeBlockSyntax
Properties
| Name | Description |
|---|---|
| ClosingFenceToken | Gets the closing fence, or the default token when there is none. |
| Code | Gets the code: its lines without the indentation of the block and the markers of its containers, each one ended by \n. |
| Info | Gets the info string, without its escapes and entities, or null when there is none. |
| InfoToken | Gets the info string after the opening fence, or the default token when there is none. |
| IsFenced | Gets a value indicating whether the code is between fences rather than indented. |
| Language | Gets the first word of the info string, which names the language of the code, or null. |
| LineTokens | Gets the tokens of the lines of the code, with their line endings. |
| OpeningFenceToken | Gets the opening fence, or the default token for an indented code block. |
ClosingFenceToken
MarkdownCodeBlockSyntax.csGets the closing fence, or the default token when there is none.
public SyntaxToken ClosingFenceToken { get; }Property value
InfoToken
MarkdownCodeBlockSyntax.csGets the info string after the opening fence, or the default token when there is none.
public SyntaxToken InfoToken { get; }Property value
IsFenced
MarkdownCodeBlockSyntax.csLanguage
MarkdownCodeBlockSyntax.csLineTokens
MarkdownCodeBlockSyntax.csGets the tokens of the lines of the code, with their line endings.
public ImmutableArray<SyntaxToken> LineTokens { get; }Property value
OpeningFenceToken
MarkdownCodeBlockSyntax.csGets the opening fence, or the default token for an indented code block.
public SyntaxToken OpeningFenceToken { get; }Property value
Methods
| Name | Description |
|---|---|
| Accept(MarkdownSyntaxVisitor) | |
| Accept<TResult>(MarkdownSyntaxVisitor<TResult>) | |
| GetPlainText() | |
| WithInfo(string?) | Returns this fenced code block with the info string info, or itself when it has this info string. |
Accept overloads
Accept(MarkdownSyntaxVisitor)
MarkdownCodeBlockSyntax.cspublic override void Accept(MarkdownSyntaxVisitor visitor)Parameters
visitorMarkdownSyntaxVisitor
No documentation is available.
Accept<TResult>(MarkdownSyntaxVisitor<TResult>)
MarkdownCodeBlockSyntax.cspublic override TResult? Accept<TResult>(MarkdownSyntaxVisitor<TResult> visitor)No documentation is available.
GetPlainText()
MarkdownCodeBlockSyntax.csWithInfo(string?)
MarkdownCodeBlockSyntax.csReturns this fenced code block with the info string info, or itself when it has this info string.
public MarkdownCodeBlockSyntax WithInfo(string? info)Parameters
infostring?- The info string, which is escaped: it is the
MarkdownCodeBlockSyntax.Infoof the block, without the whitespace around it.nullor a blank text removes the info string.
Returns
Exceptions
ArgumentExceptioninfocontains a line ending.InvalidOperationException- The block is an indented code block, which has no info string.
Remarks
The block is in no tree: replace this one with it, with SyntaxNodeExtensions.ReplaceNode.