FencedCodeBlock Class

Represents a fenced code block.

public class FencedCodeBlock : CodeBlock, IBlock, IFencedBlock, IMarkdownObject

Remarks

Related to CommonMark spec: 4.5 Fenced code blocks

Inheritance
CodeBlock FencedCodeBlock
Implements

Constructors

NameDescription
FencedCodeBlock(BlockParser)Initializes a new instance of the FencedCodeBlock class.

FencedCodeBlock(BlockParser)

FencedCodeBlock.cs

Initializes a new instance of the FencedCodeBlock class.

public FencedCodeBlock(BlockParser parser)

Parameters

parser BlockParser
The parser.

Properties

NameDescription
ArgumentsGets or sets the arguments after the IFencedBlock.Info. May be null.
ClosingFencedCharCountGets or sets the fenced character count used to close this fenced code block.
FencedCharGets or sets the fenced character used to open and close this fenced code block.
IndentCountGets or sets the indent count when the fenced code block was indented and we need to remove up to indent count chars spaces from the beginning of a line.
InfoGets or sets the language parsed after the first line of the fenced code block. May be null.
InfoNewLineNewline of the line with the opening fenced chars. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise NewLine.None.
OpeningFencedCharCountGets or sets the fenced character count used to open this fenced code block.
TriviaAfterArgumentsGets or sets the trivia after the IFencedBlock.Arguments. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.
TriviaAfterFencedCharGets or sets the trivia after the IFencedBlock.FencedChar. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.
TriviaAfterInfoGets or sets the trivia after the IFencedBlock.Info. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.
TriviaBeforeClosingFenceTrivia before the closing fenced chars Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.
UnescapedArgumentsNon-escaped IFencedBlock.Arguments exactly as in source markdown. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.
UnescapedInfoNon-escaped IFencedBlock.Info exactly as in source markdown. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.

Gets or sets the arguments after the IFencedBlock.Info. May be null.

public string? Arguments { get; set; }

Property value

string?

ClosingFencedCharCount

FencedCodeBlock.cs

Gets or sets the fenced character count used to close this fenced code block.

public int ClosingFencedCharCount { get; set; }

Property value

int

Gets or sets the fenced character used to open and close this fenced code block.

public char FencedChar { get; set; }

Property value

char

Gets or sets the indent count when the fenced code block was indented and we need to remove up to indent count chars spaces from the beginning of a line.

public int IndentCount { get; set; }

Property value

int

Gets or sets the language parsed after the first line of the fenced code block. May be null.

public string? Info { get; set; }

Property value

string?

Newline of the line with the opening fenced chars. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise NewLine.None.

public NewLine InfoNewLine { get; set; }

Property value

NewLine

OpeningFencedCharCount

FencedCodeBlock.cs

Gets or sets the fenced character count used to open this fenced code block.

public int OpeningFencedCharCount { get; set; }

Property value

int

TriviaAfterArguments

FencedCodeBlock.cs

Gets or sets the trivia after the IFencedBlock.Arguments. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.

public StringSlice TriviaAfterArguments { get; set; }

Property value

StringSlice

TriviaAfterFencedChar

FencedCodeBlock.cs

Gets or sets the trivia after the IFencedBlock.FencedChar. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.

public StringSlice TriviaAfterFencedChar { get; set; }

Property value

StringSlice

TriviaAfterInfo

FencedCodeBlock.cs

Gets or sets the trivia after the IFencedBlock.Info. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.

public StringSlice TriviaAfterInfo { get; set; }

Property value

StringSlice

TriviaBeforeClosingFence

FencedCodeBlock.cs

Trivia before the closing fenced chars Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.

public StringSlice TriviaBeforeClosingFence { get; set; }

Property value

StringSlice

UnescapedArguments

FencedCodeBlock.cs

Non-escaped IFencedBlock.Arguments exactly as in source markdown. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.

public StringSlice UnescapedArguments { get; set; }

Property value

StringSlice

UnescapedInfo

FencedCodeBlock.cs

Non-escaped IFencedBlock.Info exactly as in source markdown. Trivia: only parsed when MarkdownPipeline.TrackTrivia is enabled, otherwise StringSlice.Empty.

public StringSlice UnescapedInfo { get; set; }

Property value

StringSlice