< Back

Get-MarkdownMetadata

Sat Jan 18, 2020 7:08 pm

NAME Get-MarkdownMetadata



SYNOPSIS

Gets metadata from the header of a markdown file.





SYNTAX

Get-MarkdownMetadata -Path <String[]> [<CommonParameters>]



Get-MarkdownMetadata -Markdown <String> [<CommonParameters>]





DESCRIPTION

The Get-MarkdownMetadata cmdlet gets the metadata from the header of a markdown file that is supported by PlatyPS.

The command returns the metadata as a hash table.



PlatyPS stores metadata in the header block of a markdown file as key-value pairs of strings. By default, PlatyPS

stores help file name and markdown schema version.



Metadata section can contain user-provided values for use with external tools. The New-ExternalHelp

(New-ExternalHelp.md)cmdlet ignores this metadata.





PARAMETERS

-Path <String[]>

Specifies an array of paths of markdown files or folders.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? true



-Markdown <String>

Specifies a string that contains markdown formatted text.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

String[]

You can pipe an array of paths to this cmdlet.





OUTPUTS

Dictionary[String, String]

The cmdlet returns a Dictionary[String, String] object. The dictionary contains key-value pairs found in the

markdown metadata block.





NOTES









------------- Example 1: Get metadata from a file -------------



PS C:\\> Get-MarkdownMetadata -Path ".\\docs\\Get-MarkdownMetadata.md"



Key Value

--- -----

external help file platyPS-help.xml

schema 2.0.0



This command retrieves metadata from a markdown file.

-------- Example 2: Get metadata from a markdown string --------



PS C:\\> $Markdown = Get-Content -Path ".\\docs\\Get-MarkdownMetadata.md" -Raw

PS C:\\> Get-MarkdownMetadata -Markdown $Markdown



Key Value

--- -----

external help file platyPS-help.xml

schema 2.0.0



The first command gets the contents of a file, and stores them in the $Markdown variable.



The second command retrieves metadata from the string in $Metadata.

------ Example 3: Get metadata from all files in a folder ------



PS C:\\> Get-MarkdownMetadata -Path ".\\docs"



Key Value

--- -----

external help file platyPS-help.xml

schema 2.0.0

external help file platyPS-help.xml

schema 2.0.0

external help file platyPS-help.xml

schema 2.0.0

external help file platyPS-help.xml

schema 2.0.0

external help file platyPS-help.xml

schema 2.0.0

external help file platyPS-help.xml

schema 2.0.0

external help file platyPS-help.xml

schema 2.0.0

external help file platyPS-help.xml

schema 2.0.0



This command gets metadata from each of the markdown files in the .\\docs folder.



RELATED LINKS

Online Version: https://github.com/PowerShell/platyPS/b ... etadata.md