Edit

Share via


New-MarkdownModuleFile

Creates the Markdown module file for a PowerShell module.

Syntax

__AllParameterSets

New-MarkdownModuleFile
    -OutputFolder <string>
    [-CommandHelp <CommandHelp[]>]
    [-Encoding <Encoding>]
    [-Force]
    [-HelpInfoUri <string>]
    [-HelpVersion <version>]
    [-Locale <string>]
    [-Metadata <hashtable>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

This command creates the Markdown module file for a PowerShell module. The module file contains the module metadata and a list of all commands with their synopsis descriptions. This file can be used as the module landing page in a documentation set. The module metadata is used to by Export-MamlCommandHelp to create the MAML help file for the module.

Examples

Example 1 - Create a new module file from a folder of command help files

$mdfiles = Measure-PlatyPSMarkdown -Path .\v2\Microsoft.PowerShell.PlatyPS\*.md
$mdfiles | Where-Object Filetype -match 'CommandHelp' |
    Import-MarkdownCommandHelp -Path {$_.FilePath} |
    New-MarkdownModuleFile -OutputFolder .\v2 -Force
    Directory: D:\Docs\v2\Microsoft.PowerShell.PlatyPS

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           9/18/2024  1:49 PM           2129 Microsoft.PowerShell.PlatyPS.md

Example 2 - Create a new module file from a list of commands

$newMarkdownCommandHelpSplat = @{
    CommandHelp  = Get-Command -Module Microsoft.PowerShell.PlatyPS | New-CommandHelp
    OutputFolder = '.\new'
    Force        = $true
}
New-MarkdownModuleFile @newMarkdownCommandHelpSplat
    Directory: D:\Docs\new\Microsoft.PowerShell.PlatyPS

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           9/18/2024  1:49 PM           2129 Microsoft.PowerShell.PlatyPS.md

Parameters

-CommandHelp

The CommandHelp objects to be included in the module file. You can pass the CommandHelp object on the pipeline or by using the Command parameter.

Parameter properties

Type:

Microsoft.PowerShell.PlatyPS.Model.CommandHelp[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Encoding

The encoding used when creating the output files. If not specified, the cmdlet uses value specified by $OutputEncoding.

Parameter properties

Type:Encoding
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

By default, this command doesn't overwrite existing files. When you use this parameter, the cmdlet overwrites existing files.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-HelpInfoUri

This parameter allows you to specify the URI used for updateable help. By default, the cmdlet uses the HelpInfoUri specified in the module manifest.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-HelpVersion

This parameter allows you to specify the version of the help. The default value is 1.0.0.0. This version is written to the HelpInfo.xml file that is used for updateable help.

Parameter properties

Type:Version
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Locale

This parameter allows you to specify the language locale for the help files. By default, the cmdlet uses the current CultureInfo. Use the Get-Culture cmdlet to see the current culture settings on your system.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Metadata

The metadata to add to the frontmatter of the markdown file. The metadata is a hashtable where the you specify the key and value pairs to add to the frontmatter. New key names are added to the existing frontmatter. The values of existing keys are overwritten. You can't overwrite the values of the document type or PlatyPS schema version keys. If these keys are present in the hashtable, the cmdlet ignores the values and outputs a warning.

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-OutputFolder

Specifies the location of where the Markdown module file is written. The cmdlet creates a folder for each module based on the CommandHelp object being processed.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Runs the command in a mode that only reports what would happen without performing the actions.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
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

Microsoft.PowerShell.PlatyPS.Model.CommandHelp

Outputs

FileInfo