MarkdownInlineExtension Class
An inline syntax that starts at one of MarkdownInlineExtension.TriggerCharacters, such as @mention or {{variable}}. The parser calls MarkdownInlineExtension.TryParse at each trigger character, before the built-in syntaxes, and the construct becomes a MarkdownExtensionInlineSyntax.
public abstract class MarkdownInlineExtension : MarkdownSyntaxExtensionRemarks
The extensions of a character are tried in the order of MarkdownParseOptions.SyntaxExtensions, then the built-in syntaxes. A construct is atomic, as a code span: the delimiters of emphasis and the brackets of links do not match across its edges, and the content added with MarkdownInlineParseContext.AddInlines is parsed on its own. The parser does not call extensions in code spans, in autolinks, in raw HTML, or after a backslash.
One instance parses every document, possibly on several threads at once: keep no state between calls.
- Inheritance
MarkdownSyntaxExtensionMarkdownInlineExtension
Constructors
| Name | Description |
|---|---|
| MarkdownInlineExtension(string, string) | Initializes a new instance of the MarkdownInlineExtension class. |
MarkdownInlineExtension(string, string)
MarkdownInlineExtension.csInitializes a new instance of the MarkdownInlineExtension class.
Parameters
namestring- The name of the extension, which the nodes of its constructs have.
triggerCharactersstring- The characters where a construct can start: not whitespace.
Exceptions
ArgumentExceptionnameortriggerCharactersis empty, ortriggerCharactershas whitespace.ArgumentNullExceptionnameortriggerCharactersisnull.
Properties
| Name | Description |
|---|---|
| TriggerCharacters | Gets the characters where a construct can start. |
TriggerCharacters
MarkdownInlineExtension.csMethods
| Name | Description |
|---|---|
| TryParse(MarkdownInlineParseContext) | Reads a construct at a trigger character, the first character of MarkdownInlineParseContext.Text. |
TryParse(MarkdownInlineParseContext)
Reads a construct at a trigger character, the first character of MarkdownInlineParseContext.Text.
public abstract bool TryParse(ref MarkdownInlineParseContext context)Parameters
contextMarkdownInlineParseContext- The text from the trigger character, where the construct reports its parts and its length.
Returns
bool true when the text is a construct, after calling MarkdownInlineParseContext.Complete; false to let the next extension, or the built-in syntaxes, read the text.