Parse

The Parse static method inspects a Markdown document for any links inside it.

Overloads

Parse(String)
Inspects a string for any instances of Markdown link syntaxes, returning an instance of the DocumentLink class for every parsed link.
Parse(System.IO.FileInfo)
Inspects a file’s content for any instances of Markdown link syntaxes, returning an instance of the DocumentLink class for every parsed link.

Parse(String)

Inspects a string for any instances of Markdown link syntaxes, returning an instance of the DocumentLink class for every parsed link.

Parse([string]$Markdown)

Parameters

Markdown

The string of Markdown text to parse for links.

Returns

Zero or more instances representing every parsed link from the text.

Exceptions

None.

This example demonstrates parsing a Markdown file for links.

$Content = @'
This is a [markdown](/concepts/markdown.md) file.

You can add links like:

> ```md
> [<text>](url 'title')
> ```

[another](one), with [a third](too 'even a caption').
'@
[DocumentLink]::Parse($Content)
Kind        : TextInline
Text        : markdown
Destination : /concepts/markdown.md
Title       :
ReferenceID :
Position    : 1:11
Markdown    : [markdown](/concepts/markdown.md)

Kind        : TextInline
Text        : another
Destination : one
Title       :
ReferenceID :
Position    : 9:1
Markdown    : [another](one)

Kind        : TextInline
Text        : a third
Destination : too
Title       : even a caption
ReferenceID :
Position    : 9:22
Markdown    : [a third](too 'even a caption')

Parse(System.IO.FileInfo)

Inspects a file’s content for any instances of Markdown link syntaxes, returning an instance of the DocumentLink class for every parsed link.

Parse([System.IO.FileInfo]$FileInfo)

Parameters

Markdown

The file whose content to parse for Markdown links.

Returns

Zero or more instances representing every parsed link from the file.

Exceptions

None.

Examples

This example demonstrates parsing a Markdown file for links.

$Readme = Get-Item -Path ./README.md
[DocumentLink]::Parse($Readme)