Skip to content

Commit 1a6dc34

Browse files
🩹 [Patch]: Fix frontmatter title in markdown files by updating 'title:' to 'ms.title:' for improved documentation consistency
1 parent 6b865bc commit 1a6dc34

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

‎scripts/helpers/Build-PSModuleDocumentation.ps1‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@
5858
try {
5959
Write-Host "$($command.Name)" -NoNewline
6060
$params = @{
61-
CommandInfo = $command
62-
OutputFolder = $docsOutputFolder
63-
Encoding = 'utf8'
64-
ProgressAction = 'SilentlyContinue'
65-
ErrorAction = 'Stop'
66-
Force = $true
61+
CommandInfo = $command
62+
OutputFolder = $docsOutputFolder
63+
Encoding = 'utf8'
64+
ProgressAction = 'SilentlyContinue'
65+
ErrorAction = 'Stop'
66+
Force = $true
6767
}
6868
$null = New-MarkdownCommandHelp @params
6969
Write-Host ' - ✓' -ForegroundColor Green
@@ -129,6 +129,14 @@
129129
Move-Item -Path $file.FullName -Destination $docsFilePath -Force
130130
}
131131

132+
Write-Host '::group::Build docs - Fix frontmatter title'
133+
Get-ChildItem -Path $moduleDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
134+
$content = Get-Content -Path $_.FullName -Raw
135+
# Replace 'title:' with 'ms.title:' in frontmatter only (between --- markers)
136+
$content = $content -replace '(?s)^(---.*?)title:(.*?---)', '$1ms.title:$2'
137+
$content | Set-Content -Path $_.FullName
138+
}
139+
132140
Write-Host '::group::Build docs - Move markdown files from source files to docs'
133141
$moduleDocsFolder = Join-Path $DocsOutputFolder.FullName $ModuleName
134142
Get-ChildItem -Path $PublicFunctionsFolder -Recurse -Force -Include '*.md' | ForEach-Object {

0 commit comments

Comments
 (0)