Skip to content

Switch CodeFenceToYamlFrontMatter

Nick Spreitzer edited this page Nov 16, 2019 · 6 revisions
external help file: WhatsNew.dll-Help.xml
Module Name: WhatsNew
schema: 2.0.0

Switch-CodeFenceToYamlFrontMatter

SYNOPSIS

Converts a markdown code fence to yaml front matter.

SYNTAX

Switch-CodeFenceToYamlFrontMatter [-Path] <String> [-NoConfirm] [<CommonParameters>]

DESCRIPTION

If you happen to use platyPS to create markdown documentation for PowerShell modules (as I do), you may have noticed that the metadata platyPS emits as yaml front matter doesn't render all that nicely on GitHub. This command, along with the corresponding Switch-YamlFrontMatterToCodeFence, is a bit of a hack that allow you to both keep the metadata and have markdown docs that look pretty on GitHub. All it does is look for a code fence at the top of the file and, if one is found, convert it to yaml front matter. This is useful if you've previous run Switch-YamlFrontMatterToCodeFence to get your markdown documentation to display nice and pretty on GitHub but now need to run Update-MarkdownHelp, which won't work unless that metadata exists as front matter.

EXAMPLES

Example 1

PS C:\> Switch-CodeFenceToYamlFrontMatter -Path "C:\Repos\whats-new.wiki"

Loads each markdown file found in C:\Repos\whats-new.wiki, looks for a code fence at the top of the file, and - if found - converts it to yaml front matter and overwrites the original file with the changes.

PARAMETERS

-Path

The directory containing markdown files with yaml front matter that's previous been converted to a code fence.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-NoConfirm

Update the files without prompting first.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

RELATED LINKS

Switch-CodeFenceToYamlFrontMatter

Clone this wiki locally