Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
PlatyPS förväntar sig att Markdown-filerna följer en specifik struktur. Om strukturen inte är korrekt kan konverteringen till MAML-format misslyckas eller så kan MAML-innehållet vara ofullständigt. När du är klar med redigeringen av Markdown-filerna bör du testa dem för att se till att strukturen är korrekt.
Det bästa sättet att testa hjälpfilen för Markdown-kommandot är att importera filen och inspektera det resulterande objektet. I följande exempel importeras Markdown-filen för Measure-PlatyPSMarkdown kommandot och det resulterande objektet lagras i variabeln $cmdHelp . Kommandot Format-List * visar alla egenskaper för objektet. Granska egenskaperna för att säkerställa att de innehåller det förväntade innehållet.
$cmdFilePath = '.\Microsoft.PowerShell.PlatyPS\Measure-PlatyPSMarkdown.md'
$cmdHelp = Import-MarkdownCommandHelp -Path $cmdFilePath
$cmdHelp | Format-List *
Metadata : {[document type, cmdlet], [external help file, WidgetModule-Help.xml],
[HelpUri, ], [Locale, en-US]…}
Locale : en-US
ModuleGuid :
ExternalHelpFile : WidgetModule-Help.xml
OnlineVersionUrl :
SchemaVersion : 2024-05-01
ModuleName : WidgetModule
Title : Get-Widget
Synopsis : Gets one or more widgets based on specified criteria.
Syntax : {Get-Widget [-Name] <string> [-Color <ConsoleColor>] [-Size <int>]
[-Detailed] [<CommonParameters>]}
AliasHeaderFound : True
Aliases :
Description : Gets one or more widgets from the system. You can filter the results
by specifying the widget's name, color, or size. Use the -Detailed
switch to retrieve additional information about each widget.
each widget.
Examples : {Microsoft.PowerShell.PlatyPS.Model.Example}
Parameters : {Color, Detailed, Name, Size}
Inputs : {System.String}
Outputs : {Widget}
Notes :
RelatedLinks : {Microsoft.PowerShell.PlatyPS.Model.Links}
HasCmdletBinding : True
HasWorkflowCommonParameters : False
Diagnostics : Microsoft.PowerShell.PlatyPS.Model.Diagnostics
Den $cmdHelp innehåller också en Diagnostics-egenskap som innehåller information om eventuella strukturella problem med Markdown-filen. Granska diagnostikinformationen och korrigera eventuella problem i Markdown-filen.
$cmdHelp.Diagnostics.Messages
Kolumnen Allvarlighetsgrad anger hur allvarligt problemet är. Varningar och fel bör undersökas och korrigeras.
Source Severity Message Identifier
------ -------- ------- ----------
Metadata Information {Metadata} found 'external help …
Metadata Information {Metadata} found 'Locale'
Metadata Information {Metadata} found 'Module Name'
Metadata Information {Metadata} found 'ms.date'
Metadata Information {Metadata} found 'HelpUri'
Metadata Information {Metadata} found 'PlatyPS schema…
Metadata Information {Metadata} found 'title'
General Information {CmdletBinding is present} GetCmdletBindingState
General Information {Workflow parameters not present} GetWorkflowCommonPara…
Synopsis Information {SYNOPSIS found}
Syntax Information {Syntax found} Get-Widget [-Name] <s…
Alias Information {ALIASES header found} alias header is AST 8
Alias Information {Alias string length} alias string length: 0
Description Information {DESCRIPTION header found} DESCRIPTION
Example Information {EXAMPLES header found} 1 examples found
Parameter Information {Parameters} 4 parameters found
Parameter Information {Color found} Version 2 metadata fo…
Parameter Information {Detailed found} Version 2 metadata fo…
Parameter Information {Name found} Version 2 metadata fo…
Parameter Information {Size found} Version 2 metadata fo…
Parameter Information {CommonParameters found} GetParameters
Inputs Information {GetInput} 1 items found
Outputs Information {GetOutput} 1 items found
Notes Warning {Notes content not found} GetNotes
Links Information {Links found} GetRelatedLinks
Links Information {Found related links as unordered list.}
Links Information {adding link [All about widgets](https://docs…
Links Information {Links found} 1 links found
Mer information om den förväntade strukturen för Markdown-filerna finns i Redigera Markdown-hjälpfiler.
Du kan testa modulens Markdown-filer på ett liknande sätt med hjälp av kommandot Import-MarkdownModuleFile . Till exempel:
$modFilePath = '.\Microsoft.PowerShell.PlatyPS\Microsoft.PowerShell.PlatyPS.md'
$mod = Import-MarkdownModuleFile -Path $modFilePath
$mod.Diagnostics.Messages
Source Severity Message Identifier
------ -------- ------- ----------
ModuleFileTitle Information {Title WidgetModule Module… GetModuleFileTitle…
Metadata Information {found guid 8bc631f3-e82e-… GetMetadata
Metadata Information {found module name WidgetM… GetMetadata
Metadata Information {locale set to en-US} GetMetadata
ModuleFileDescription Information {Module description found} GetModuleFileDescr…
ModuleFileCommand Information {command Get-Widget found} GetModuleFileComma…