MarkdownParagraphExtension Class

Turns the lines of a paragraph into a block, such as the lines Alice: Hello of a chat transcript. The construct is a MarkdownExtensionBlockSyntax whose parts are markers, text and inlines, as an inline extension reports them.

public abstract class MarkdownParagraphExtension : MarkdownSyntaxExtension

Remarks

The parser calls MarkdownParagraphExtension.TryConvert when a paragraph is closed, after its link reference definitions are read, and before the inlines of the document are read: a converter can record definitions in its state for the inline extensions. A converter can take some lines of the paragraph: the lines before them stay a paragraph, and the lines after them are offered to the converters again. A paragraph that is a setext heading is not offered.

One instance parses every document, possibly on several threads at once: keep no state between calls, and use MarkdownSyntaxExtension.CreateState for the state of a document.

Inheritance
MarkdownSyntaxExtension MarkdownParagraphExtension

Constructors

NameDescription
MarkdownParagraphExtension(string)Initializes a new instance of the MarkdownParagraphExtension class.

MarkdownParagraphExtension(string)

MarkdownParagraphExtension.cs

Initializes a new instance of the MarkdownParagraphExtension class.

protected MarkdownParagraphExtension(string name)

Parameters

name string
The name of the extension, which the nodes of its blocks have.

Exceptions

ArgumentException
name is empty.
ArgumentNullException
name is null.

Methods

NameDescription
TryConvert(MarkdownParagraphConvertContext)Reads lines of a paragraph.

TryConvert(MarkdownParagraphConvertContext)

Reads lines of a paragraph.

public abstract bool TryConvert(ref MarkdownParagraphConvertContext context)

Parameters

context MarkdownParagraphConvertContext
The lines, where the block reports its parts and its lines.

Returns

bool true when some lines are a block, after calling MarkdownParagraphConvertContext.Complete; false to let the next converter read the lines, or to keep the paragraph.