Get-MarkdownMetadata
Gets metadata from the header of a markdown file.
Syntax
FromPath (Default)
Get-MarkdownMetadata
-Path <String[]>
[<CommonParameters>]
FromMarkdownString
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 cmdlet ignores this metadata.
Examples
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.
Parameters
-Markdown
Specifies a string that contains markdown formatted text.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
FromMarkdownString
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Path
Specifies an array of paths of markdown files or folders.
Parameter properties
Type: | String[] |
Default value: | None |
Supports wildcards: | True |
DontShow: | False |
Parameter sets
FromPath
Position: | Named |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
String
You can pipe an array of paths to this cmdlet.
Outputs
Dictionary
The cmdlet returns a Dictionary[String, String]
object. The dictionary contains key-value pairs
found in the markdown metadata block.