MarkdownInlineParseContext Struct

  • Obsolete: Types with embedded references are not supported in this version of your compiler.

The text where a MarkdownInlineExtension reads a construct, and where it reports the parts of the construct: markers, text, and nested inlines. The positions are relative to the start of MarkdownInlineParseContext.Text.

[Obsolete("Types with embedded references are not supported in this version of your compiler.", true)]
public ref struct MarkdownInlineParseContext

Remarks

The parts are reported in the order of the text, without overlapping. The characters of the construct that no part covers are text. The node of the construct has every character of its range, so the tree still reproduces the document.

Properties

NameDescription
LengthGets the length of the construct, once MarkdownInlineParseContext.Complete is called, or 0.
OptionsGets the options of the parser.
PreviousCharacterGets the character before the trigger character, or \0 at the start of the inlines.
StateGets the state of the extension for the document, which MarkdownSyntaxExtension.CreateState creates: what the block extensions recorded in it, as every block of the document is read before the first inline.
TextGets the text from the trigger character to the end of the inlines of the block, such as a paragraph. The markers of the containers of the lines, such as the > of a block quote, are not in it, and the lines end with \n.

Gets the length of the construct, once MarkdownInlineParseContext.Complete is called, or 0.

public readonly int Length { get; }

Property value

int

Gets the options of the parser.

public readonly MarkdownParseOptions Options { get; }

Property value

MarkdownParseOptions

Gets the character before the trigger character, or \0 at the start of the inlines.

public readonly char PreviousCharacter { get; }

Property value

char

Gets the state of the extension for the document, which MarkdownSyntaxExtension.CreateState creates: what the block extensions recorded in it, as every block of the document is read before the first inline.

public readonly object? State { get; }

Property value

object?

Gets the text from the trigger character to the end of the inlines of the block, such as a paragraph. The markers of the containers of the lines, such as the > of a block quote, are not in it, and the lines end with \n.

public readonly ReadOnlySpan<char> Text { get; }

Property value

ReadOnlySpan<char>

Methods

NameDescription
AddInlines(int, int)Reports content that the parser reads as inlines, such as emphasis and links, on its own: its delimiters and its brackets do not match the ones outside. It cannot start the construct: the trigger character is a marker or text.
AddMarker(int, int)Reports a marker of the construct, such as @, which the HTML does not have by default.
AddText(int, int)Reports text of the construct, such as the name of a mention, which the HTML has by default, escaped.
Complete(int)Ends the construct, which has the first length characters of MarkdownInlineParseContext.Text.
GetState(MarkdownSyntaxExtension)Gets the state of another extension of the options for the document, such as the block extension whose definitions an inline extension reads.

AddInlines(int, int)

MarkdownInlineParseContext.cs

Reports content that the parser reads as inlines, such as emphasis and links, on its own: its delimiters and its brackets do not match the ones outside. It cannot start the construct: the trigger character is a marker or text.

public void AddInlines(int start, int length)

Parameters

start int
length int

Exceptions

ArgumentOutOfRangeException
The range is empty, starts the construct, is not in MarkdownInlineParseContext.Text, or starts before the end of the previous part.
InvalidOperationException
MarkdownInlineParseContext.Complete was called.

Reports a marker of the construct, such as @, which the HTML does not have by default.

public void AddMarker(int start, int length)

Parameters

start int
length int

Exceptions

ArgumentOutOfRangeException
The range is empty, is not in MarkdownInlineParseContext.Text, or starts before the end of the previous part.
InvalidOperationException
MarkdownInlineParseContext.Complete was called.

Reports text of the construct, such as the name of a mention, which the HTML has by default, escaped.

public void AddText(int start, int length)

Parameters

start int
length int

Exceptions

ArgumentOutOfRangeException
The range is empty, is not in MarkdownInlineParseContext.Text, or starts before the end of the previous part.
InvalidOperationException
MarkdownInlineParseContext.Complete was called.

Ends the construct, which has the first length characters of MarkdownInlineParseContext.Text.

public void Complete(int length)

Parameters

length int

Exceptions

ArgumentOutOfRangeException
length is not positive, is longer than MarkdownInlineParseContext.Text, or ends before the last part.
InvalidOperationException
MarkdownInlineParseContext.Complete was called.

GetState(MarkdownSyntaxExtension)

MarkdownInlineParseContext.cs

Gets the state of another extension of the options for the document, such as the block extension whose definitions an inline extension reads.

public readonly object? GetState(MarkdownSyntaxExtension extension)

Parameters

extension MarkdownSyntaxExtension

Returns

object?

Exceptions

ArgumentException
extension is not in MarkdownParseOptions.SyntaxExtensions.
ArgumentNullException
extension is null.