MarkdownHeadingSyntax Class
An ATX heading (# Title) or a setext heading (a paragraph underlined by = or -).
public sealed class MarkdownHeadingSyntax : MarkdownBlockSyntax- Inheritance
MarkdownBlockSyntaxMarkdownHeadingSyntax
Properties
| Name | Description |
|---|---|
| ClosingSequenceToken | Gets the optional # that close an ATX heading, or the default token when there are none. |
| Identifier | Gets the identifier of the heading, which the HTML renderer writes as its id, or null when it has none. |
| Inlines | Gets the inlines of the heading, without its markers. |
| IsSetext | Gets a value indicating whether the heading is underlined rather than opened by #. |
| Level | Gets the level of the heading, from 1 to 6: a setext heading is of level 1 or 2. |
| MarkerToken | Gets the # that open an ATX heading, or the default token for a setext heading. |
| UnderlineToken | Gets the = or - that underline a setext heading, or the default token for an ATX heading. |
ClosingSequenceToken
MarkdownHeadingSyntax.csGets the optional # that close an ATX heading, or the default token when there are none.
public SyntaxToken ClosingSequenceToken { get; }Property value
Identifier
MarkdownHeadingSyntax.csGets the identifier of the heading, which the HTML renderer writes as its id, or null when it has none.
public string? Identifier { get; }Property value
Remarks
It is the id of its generic attributes, or, with MarkdownExtensions.AutoIdentifiers, an identifier made from its text: ## Getting started is getting-started. The identifiers made from the same text are made unique by a suffix: the second ## Getting started is getting-started-1.
Inlines
MarkdownHeadingSyntax.csGets the inlines of the heading, without its markers.
public IEnumerable<SyntaxNodeOrToken> Inlines { get; }Property value
IsSetext
MarkdownHeadingSyntax.csMarkerToken
MarkdownHeadingSyntax.csGets the # that open an ATX heading, or the default token for a setext heading.
public SyntaxToken MarkerToken { get; }Property value
UnderlineToken
MarkdownHeadingSyntax.csGets the = or - that underline a setext heading, or the default token for an ATX heading.
public SyntaxToken UnderlineToken { get; }Property value
Methods
| Name | Description |
|---|---|
| Accept(MarkdownSyntaxVisitor) | |
| Accept<TResult>(MarkdownSyntaxVisitor<TResult>) | |
| GetPlainText() | |
| WithLevel(int) | Returns this heading with the level level, or itself when it has this level. |
Accept overloads
Accept(MarkdownSyntaxVisitor)
MarkdownHeadingSyntax.cspublic override void Accept(MarkdownSyntaxVisitor visitor)Parameters
visitorMarkdownSyntaxVisitor
No documentation is available.
Accept<TResult>(MarkdownSyntaxVisitor<TResult>)
MarkdownHeadingSyntax.cspublic override TResult? Accept<TResult>(MarkdownSyntaxVisitor<TResult> visitor)No documentation is available.
GetPlainText()
MarkdownHeadingSyntax.csWithLevel(int)
MarkdownHeadingSyntax.csReturns this heading with the level level, or itself when it has this level.
public MarkdownHeadingSyntax WithLevel(int level)Parameters
levelint
Returns
Exceptions
ArgumentOutOfRangeExceptionlevelis not from 1 to 6.
Remarks
The number of # of an ATX heading changes, and the underline of a setext heading is made of = for the level 1 and of - for the level 2. A setext heading of level 3 to 6 becomes an ATX heading, which has one line: the lines of the heading are joined with spaces, and a hard line break becomes a space.
The heading is in no tree: replace this one with it, with SyntaxNodeExtensions.ReplaceNode.