MarkdownPipelineBuilder Class

This class allows to modify the pipeline to parse and render a Markdown document.

public class MarkdownPipelineBuilder

Remarks

NOTE: A pipeline is not thread-safe.

Constructors

NameDescription
MarkdownPipelineBuilder()Initializes a new instance of the MarkdownPipeline class.

MarkdownPipelineBuilder()

MarkdownPipelineBuilder.cs

Initializes a new instance of the MarkdownPipeline class.

public MarkdownPipelineBuilder()

Properties

NameDescription
BlockParsersGets the block parsers.
DebugLogGets or sets the debug log.
ExtensionsGets the register extensions.
InlineParsersGets the inline parsers.
MaximumNestingDepthGets or sets the maximum nesting depth allowed for the Markdown syntax tree during parsing and rendering.
PreciseSourceLocationGets or sets a value indicating whether to enable precise source location (slower parsing but accurate position for block and inline elements)
TrackTriviaTrue to parse trivia such as whitespace, extra heading characters and unescaped string values.

Gets the block parsers.

public OrderedList<BlockParser> BlockParsers { get; }

Gets or sets the debug log.

public TextWriter? DebugLog { get; set; }

Property value

TextWriter?

Gets the register extensions.

public OrderedList<IMarkdownExtension> Extensions { get; }

Gets the inline parsers.

public OrderedList<InlineParser> InlineParsers { get; }

MaximumNestingDepth

MarkdownPipelineBuilder.cs

Gets or sets the maximum nesting depth allowed for the Markdown syntax tree during parsing and rendering.

public int MaximumNestingDepth { get; set; }

Property value

int

Exceptions

ArgumentOutOfRangeException
Thrown when the value is less than or equal to zero.

Remarks

The default value is 128. Raising this value allows deeper documents but can increase parsing cost and rendering stack usage.

PreciseSourceLocation

MarkdownPipelineBuilder.cs

Gets or sets a value indicating whether to enable precise source location (slower parsing but accurate position for block and inline elements)

public bool PreciseSourceLocation { get; set; }

Property value

bool

True to parse trivia such as whitespace, extra heading characters and unescaped string values.

public bool TrackTrivia { get; set; }

Property value

bool

Methods

NameDescription
Build()Builds a pipeline from this instance. Once the pipeline is build, it cannot be modified.

Builds a pipeline from this instance. Once the pipeline is build, it cannot be modified.

public MarkdownPipeline Build()

Returns

MarkdownPipeline

Exceptions

InvalidOperationException
An extension cannot be null

Events

NameDescription
DocumentProcessedOccurs when a document has been processed after the MarkdownParser.Parse method.

DocumentProcessed

Occurs when a document has been processed after the MarkdownParser.Parse method.

public event ProcessDocumentDelegate? DocumentProcessed