MarkdownLinkSyntax Class

A link ([text](destination), [text][label]...) or an image (![description](source)).

public sealed class MarkdownLinkSyntax : MarkdownInlineSyntax
Inheritance
MarkdownInlineSyntax MarkdownLinkSyntax

Properties

NameDescription
DefinitionGets the definition that a reference link refers to, or null.
DestinationGets the destination, without its angle brackets, escapes and entities: the one of the definition for a reference link.
DestinationTokenGets the destination of an inline link, or the default token.
HeadingGets the heading that a reference link without definition links to with MarkdownExtensions.AutoIdentifiers, or null.
IsImageGets a value indicating whether this is an image: its text is the description of the image.
LabelGets the label that refers to a link reference definition, or null for an inline link.
LinkKindGets how the link gives its destination.
TextGets the inlines of the text of the link, between its brackets.
TitleGets the title, without its quotes, escapes and entities, or null when there is none.

Gets the definition that a reference link refers to, or null.

public MarkdownLinkReferenceDefinitionSyntax? Definition { get; }

Gets the destination, without its angle brackets, escapes and entities: the one of the definition for a reference link.

public string Destination { get; }

Property value

string

Remarks

A reference link to a MarkdownLinkSyntax.Heading has # and the identifier of the heading as destination. It is empty when a reference link has no definition, which an edit can cause.

DestinationToken

MarkdownLinkSyntax.cs

Gets the destination of an inline link, or the default token.

public SyntaxToken DestinationToken { get; }

Property value

SyntaxToken

Gets the heading that a reference link without definition links to with MarkdownExtensions.AutoIdentifiers, or null.

public MarkdownHeadingSyntax? Heading { get; }

Gets a value indicating whether this is an image: its text is the description of the image.

public bool IsImage { get; }

Property value

bool

Gets the label that refers to a link reference definition, or null for an inline link.

public string? Label { get; }

Property value

string?

Remarks

The label of a collapsed or a shortcut link is its text.

Gets how the link gives its destination.

public MarkdownLinkKind LinkKind { get; }

Property value

MarkdownLinkKind

Gets the inlines of the text of the link, between its brackets.

public IEnumerable<SyntaxNodeOrToken> Text { get; }

Gets the title, without its quotes, escapes and entities, or null when there is none.

public string? Title { get; }

Property value

string?

Methods

NameDescription
Accept(MarkdownSyntaxVisitor)
Accept<TResult>(MarkdownSyntaxVisitor<TResult>)
WithDestination(string)Returns this inline link with the destination destination, or itself when it has this destination.
WithTitle(string?)Returns this inline link with the title title, or itself when it has this title.

Accept overloads

Accept(MarkdownSyntaxVisitor)

MarkdownLinkSyntax.cs
public override void Accept(MarkdownSyntaxVisitor visitor)
Parameters
visitor MarkdownSyntaxVisitor

No documentation is available.

Accept<TResult>(MarkdownSyntaxVisitor<TResult>)

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

TResult?

No documentation is available.

WithDestination(string)

MarkdownLinkSyntax.cs

Returns this inline link with the destination destination, or itself when it has this destination.

public MarkdownLinkSyntax WithDestination(string destination)

Parameters

destination string
The destination, which is escaped: it is the MarkdownLinkSyntax.Destination of the link.

Returns

MarkdownLinkSyntax

Exceptions

ArgumentNullException
destination is null.
InvalidOperationException
The link is a reference link.

Remarks

The link is in no tree: replace this one with it, with SyntaxNodeExtensions.ReplaceNode. The destination of a reference link is the one of its definition: change the definition with MarkdownLinkReferenceDefinitionSyntax.WithDestination.

WithTitle(string?)

MarkdownLinkSyntax.cs

Returns this inline link with the title title, or itself when it has this title.

public MarkdownLinkSyntax WithTitle(string? title)

Parameters

title string?
The title, which is escaped: it is the MarkdownLinkSyntax.Title of the link. null removes the title.

Returns

MarkdownLinkSyntax

Exceptions

InvalidOperationException
The link is a reference link.

Remarks

The link is in no tree: replace this one with it, with SyntaxNodeExtensions.ReplaceNode. The title of a reference link is the one of its definition: change the definition with MarkdownLinkReferenceDefinitionSyntax.WithTitle.