MarkdownHeadingSyntax Class

An ATX heading (# Title) or a setext heading (a paragraph underlined by = or -).

public sealed class MarkdownHeadingSyntax : MarkdownBlockSyntax
Inheritance
MarkdownBlockSyntax MarkdownHeadingSyntax

Properties

NameDescription
ClosingSequenceTokenGets the optional # that close an ATX heading, or the default token when there are none.
IdentifierGets the identifier of the heading, which the HTML renderer writes as its id, or null when it has none.
InlinesGets the inlines of the heading, without its markers.
IsSetextGets a value indicating whether the heading is underlined rather than opened by #.
LevelGets the level of the heading, from 1 to 6: a setext heading is of level 1 or 2.
MarkerTokenGets the # that open an ATX heading, or the default token for a setext heading.
UnderlineTokenGets the = or - that underline a setext heading, or the default token for an ATX heading.

ClosingSequenceToken

MarkdownHeadingSyntax.cs

Gets the optional # that close an ATX heading, or the default token when there are none.

public SyntaxToken ClosingSequenceToken { get; }

Property value

SyntaxToken

Gets 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

string?

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.

Gets the inlines of the heading, without its markers.

public IEnumerable<SyntaxNodeOrToken> Inlines { get; }

Gets a value indicating whether the heading is underlined rather than opened by #.

public bool IsSetext { get; }

Property value

bool

Gets the level of the heading, from 1 to 6: a setext heading is of level 1 or 2.

public int Level { get; }

Property value

int

Gets the # that open an ATX heading, or the default token for a setext heading.

public SyntaxToken MarkerToken { get; }

Property value

SyntaxToken

Gets the = or - that underline a setext heading, or the default token for an ATX heading.

public SyntaxToken UnderlineToken { get; }

Property value

SyntaxToken

Methods

NameDescription
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.cs
public override void Accept(MarkdownSyntaxVisitor visitor)
Parameters
visitor MarkdownSyntaxVisitor

No documentation is available.

Accept<TResult>(MarkdownSyntaxVisitor<TResult>)

MarkdownHeadingSyntax.cs
public override TResult? Accept<TResult>(MarkdownSyntaxVisitor<TResult> visitor)
Type parameters
TResult
Parameters
visitor MarkdownSyntaxVisitor<TResult>
Returns

TResult?

No documentation is available.

public override string GetPlainText()

Returns

string

No documentation is available.

Returns this heading with the level level, or itself when it has this level.

public MarkdownHeadingSyntax WithLevel(int level)

Parameters

level int

Returns

MarkdownHeadingSyntax

Exceptions

ArgumentOutOfRangeException
level is 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.