|
73 | 73 | } |
74 | 74 | } |
75 | 75 |
|
76 | | - $moduleDocsFolder = Join-Path $docsOutputFolder $ModuleName | Get-Item |
77 | | - |
78 | 76 | Write-Host '::group::Build docs - Generated files' |
79 | | - Get-ChildItem -Path $moduleDocsFolder -Recurse | Select-Object -ExpandProperty FullName |
| 77 | + Get-ChildItem -Path $docsOutputFolder -Recurse | Select-Object -ExpandProperty FullName |
80 | 78 | Write-Host '::endgroup::' |
81 | 79 |
|
82 | | - Get-ChildItem -Path $moduleDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
| 80 | + Get-ChildItem -Path $docsOutputFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
83 | 81 | $fileName = $_.Name |
84 | 82 | Write-Host "::group:: - [$fileName]" |
85 | 83 | Show-FileContent -Path $_ |
86 | 84 | } |
87 | 85 |
|
88 | 86 | Write-Host '::group::Build docs - Fix markdown code blocks' |
89 | | - Get-ChildItem -Path $moduleDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
| 87 | + Get-ChildItem -Path $docsOutputFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
90 | 88 | $content = Get-Content -Path $_.FullName |
91 | 89 | $fixedOpening = $false |
92 | 90 | $newContent = @() |
|
105 | 103 | } |
106 | 104 |
|
107 | 105 | Write-Host '::group::Build docs - Fix markdown escape characters' |
108 | | - Get-ChildItem -Path $moduleDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
| 106 | + Get-ChildItem -Path $docsOutputFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
109 | 107 | $content = Get-Content -Path $_.FullName -Raw |
110 | 108 | $content = $content -replace '\\`', '`' |
111 | 109 | $content = $content -replace '\\\[', '[' |
|
118 | 116 |
|
119 | 117 | Write-Host '::group::Build docs - Structure markdown files to match source files' |
120 | 118 | $PublicFunctionsFolder = Join-Path $ModuleSourceFolder.FullName 'functions\public' | Get-Item |
121 | | - Get-ChildItem -Path $moduleDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
| 119 | + Get-ChildItem -Path $docsOutputFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
122 | 120 | $file = $_ |
123 | | - $relPath = [System.IO.Path]::GetRelativePath($moduleDocsFolder, $file.FullName) |
| 121 | + $relPath = [System.IO.Path]::GetRelativePath($docsOutputFolder, $file.FullName) |
124 | 122 | Write-Host " - $relPath" |
125 | 123 | Write-Host " Path: $file" |
126 | 124 |
|
127 | 125 | # find the source code file that matches the markdown file |
128 | 126 | $scriptPath = Get-ChildItem -Path $PublicFunctionsFolder -Recurse -Force | Where-Object { $_.Name -eq ($file.BaseName + '.ps1') } |
129 | 127 | Write-Host " PS1 path: $scriptPath" |
130 | | - $docsFilePath = ($scriptPath.FullName).Replace($PublicFunctionsFolder.FullName, $moduleDocsFolder).Replace('.ps1', '.md') |
| 128 | + $docsFilePath = ($scriptPath.FullName).Replace($PublicFunctionsFolder.FullName, $docsOutputFolder).Replace('.ps1', '.md') |
131 | 129 | Write-Host " MD path: $docsFilePath" |
132 | 130 | $docsFolderPath = Split-Path -Path $docsFilePath -Parent |
133 | 131 | $null = New-Item -Path $docsFolderPath -ItemType Directory -Force |
134 | 132 | Move-Item -Path $file.FullName -Destination $docsFilePath -Force |
135 | 133 | } |
136 | 134 |
|
137 | 135 | Write-Host '::group::Build docs - Fix frontmatter title' |
138 | | - Get-ChildItem -Path $moduleDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
| 136 | + Get-ChildItem -Path $docsOutputFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
139 | 137 | $content = Get-Content -Path $_.FullName -Raw |
140 | 138 | # Replace 'title:' with 'ms.title:' in frontmatter only (between --- markers) |
141 | 139 | $content = $content -replace '(?s)^(---.*?)title:(.*?---)', '$1ms.title:$2' |
|
149 | 147 | Write-Host " - $relPath" |
150 | 148 | Write-Host " Path: $file" |
151 | 149 |
|
152 | | - $docsFilePath = ($file.FullName).Replace($PublicFunctionsFolder.FullName, $moduleDocsFolder) |
| 150 | + $docsFilePath = ($file.FullName).Replace($PublicFunctionsFolder.FullName, $docsOutputFolder) |
153 | 151 | Write-Host " MD path: $docsFilePath" |
154 | 152 | $docsFolderPath = Split-Path -Path $docsFilePath -Parent |
155 | 153 | $null = New-Item -Path $docsFolderPath -ItemType Directory -Force |
156 | 154 | Move-Item -Path $file.FullName -Destination $docsFilePath -Force |
157 | 155 | } |
158 | 156 |
|
159 | 157 | Write-Host 'ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ' |
160 | | - Get-ChildItem -Path $moduleDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
| 158 | + Get-ChildItem -Path $docsOutputFolder -Recurse -Force -Include '*.md' | ForEach-Object { |
161 | 159 | $fileName = $_.Name |
162 | 160 | Write-Host "::group:: - [$fileName]" |
163 | 161 | Show-FileContent -Path $_ |
|
0 commit comments