Skip to content

Switch YamlFrontMatterToCodeFence

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-YamlFrontMatterToCodeFence

SYNOPSIS

Converts yaml front matter to a markdown code fence.

SYNTAX

Switch-YamlFrontMatterToCodeFence [-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-CodeFenceToYamlFrontMatter, 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 take the yaml front matter syntax (three dashes) and change it to codefence syntax (three backticks). However, you have to remember to convert the code fence back to yaml before you attempt to run Update-MarkdownHelp. Otherwise, you'll run into a parse error.

EXAMPLES

Example 1

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

Loads each markdown file found in C:\Repos\whats-new.wiki, converts any contained yaml front matter to a code fence, and overwrites the original file with the changes.

PARAMETERS

-Path

The directory containing markdown files with yaml front matter.

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-YamlFrontMatterToCodeFence

Clone this wiki locally