Edit

Share via


Export-MarkdownModuleFile

Exports a ModuleFileInfo object to a markdown file.

Syntax

__AllParameterSets

Export-MarkdownModuleFile
    [-ModuleFileInfo] <ModuleFileInfo[]>
    [-Encoding <Encoding>]
    [-Force]
    [-Metadata <hashtable>]
    [-OutputFolder <string>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

This command exports a ModuleFileInfo object to a markdown file. You can add metadata frontmatter to the markdown file by using the Metadata parameter. You can get a ModuleFileInfo object by using the Import-MarkdownModuleFile cmdlet. You can import a module file that's written in the old format and export it to the new format.

Examples

Example 1 - Convert an old module file to the new format

In this example, a ModuleFileInfo object by importing a module Markdown file from the .\v1 folder. That object is then exported to a Markdown file in the new format using the Export-MarkdownModuleFile.

Import-MarkdownModuleFile -Path .\v1\Microsoft.PowerShell.PlatyPS\Microsoft.PowerShell.PlatyPS.md |
    Export-MarkdownModuleFile -OutputFolder .\v1\new\Microsoft.PowerShell.PlatyPS -Force
    Directory: D:\Git\PS-Src\platyPS\v2docs\v1\new\Microsoft.PowerShell.PlatyPS

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           8/26/2024  3:38 PM           2716 Microsoft.PowerShell.PlatyPS.md

Parameters

-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 to use when writing the markdown file. If no value is specified, encoding defaults to the value of the $OutputEncoding preference variable.

Parameter properties

Type:Encoding
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

-Force

Use the Force parameter to overwrite the output file if it already exists.

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

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

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

-ModuleFileInfo

The ModuleFileInfo object to export to a markdown file. This object is created by the Import-MarkdownModuleFile cmdlet.

Parameter properties

Type:

Microsoft.PowerShell.PlatyPS.ModuleFileInfo[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-OutputFolder

The folder where the markdown file is saved. If the folder doesn't exist, it's created.

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

-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.ModuleFileInfo

Outputs

FileInfo