Parse
The Parse static method inspects a Markdown document for any links inside it.
2 minute read
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.
1. Parsing a string for links
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
1. Parsing a document for links
This example demonstrates parsing a Markdown file for links.
$Readme = Get-Item -Path ./README.md
[DocumentLink]::Parse($Readme)
Last modified March 3, 2023: (MAINT) Rename Source folder to Projects (8b45aed)