FencedBlockParserBase<T> Class

Base parser for fenced blocks (opened by 3 or more character delimiters on a first line, and closed by at least the same number of delimiters)

public abstract class FencedBlockParserBase<T> : FencedBlockParserBase where T : Block, IFencedBlock

Type parameters

T

See also

Inheritance
FencedBlockParserBase FencedBlockParserBase<T>

Constructors

NameDescription
FencedBlockParserBase()Initializes a new instance of the FencedBlockParserBase<T> class.

FencedBlockParserBase()

FencedBlockParserBase.cs

Initializes a new instance of the FencedBlockParserBase<T> class.

protected FencedBlockParserBase()

Properties

NameDescription
InfoPrefixGets or sets the language prefix (default is "language-")
MaximumMatchCountGets or sets the maximum match count.
MinimumMatchCountGets or sets the minimum match count.

Gets or sets the language prefix (default is "language-")

public string? InfoPrefix { get; set; }

Property value

string?

MaximumMatchCount

FencedBlockParserBase.cs

Gets or sets the maximum match count.

public int MaximumMatchCount { get; set; }

Property value

int

MinimumMatchCount

FencedBlockParserBase.cs

Gets or sets the minimum match count.

public int MinimumMatchCount { get; set; }

Property value

int

Methods

NameDescription
CreateFencedBlock(BlockProcessor)Performs the create fenced block operation.
DefaultInfoParser(BlockProcessor, StringSlice, IFencedBlock, char)The default parser for the information after the fenced code block special characters (usually ` or ~)
RoundtripInfoParser(BlockProcessor, StringSlice, IFencedBlock, char)The roundtrip parser for the information after the fenced code block special characters (usually ` or ~)
TryContinue(BlockProcessor, Block)Attempts to continue parsing the specified block.
TryOpen(BlockProcessor)Attempts to open a block at the current parser position.

CreateFencedBlock(BlockProcessor)

Performs the create fenced block operation.

protected abstract T CreateFencedBlock(BlockProcessor processor)

Parameters

processor BlockProcessor

Returns

T

DefaultInfoParser(BlockProcessor, StringSlice, IFencedBlock, char)

FencedBlockParserBase.cs

The default parser for the information after the fenced code block special characters (usually ` or ~)

public static bool DefaultInfoParser(BlockProcessor state, ref StringSlice line, IFencedBlock fenced, char openingCharacter)

Parameters

state BlockProcessor
The parser processor.
line StringSlice
The line.
fenced IFencedBlock
The fenced code block.
openingCharacter char
The opening character for this fenced code block.

Returns

bool true if parsing of the line is successfull; false otherwise

RoundtripInfoParser(BlockProcessor, StringSlice, IFencedBlock, char)

FencedBlockParserBase.cs

The roundtrip parser for the information after the fenced code block special characters (usually ` or ~)

public static bool RoundtripInfoParser(BlockProcessor blockProcessor, ref StringSlice line, IFencedBlock fenced, char openingCharacter)

Parameters

blockProcessor BlockProcessor
The parser processor.
line StringSlice
The line.
fenced IFencedBlock
The fenced code block.
openingCharacter char
The opening character for this fenced code block.

Returns

bool true if parsing of the line is successfull; false otherwise

TryContinue(BlockProcessor, Block)

FencedBlockParserBase.cs

Attempts to continue parsing the specified block.

public override BlockState TryContinue(BlockProcessor processor, Block block)

Parameters

processor BlockProcessor
block Block

Returns

BlockState

TryOpen(BlockProcessor)

FencedBlockParserBase.cs

Attempts to open a block at the current parser position.

public override BlockState TryOpen(BlockProcessor processor)

Parameters

processor BlockProcessor

Returns

BlockState