Skip to content

Update Build-PSBuildMarkdown.ps1 #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"$schema": "https://raw.githubusercontent.com/DavidAnson/vscode-markdownlint/refs/heads/main/markdownlint-config-schema.json",
"MD024": {
"siblings_only": true
},
"MD013": {
"code_blocks": false,
"tables": false
}
}
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

### Breaking Changes

- [**#71**](https://github.com/psake/PowerShellBuild/pull/71) Compiled modules
are now explicitly created as UTF-8 files.

- [**#67**](https://github.com/psake/PowerShellBuild/pull/67) Overwrite existing
markdown files and use the comment based help as the source of truth. This can
be disabled if `$PSBPreference.Docs.Overwrite` is set to `$false`.

## [0.6.2] 2024-10-06

Expand Down
1 change: 1 addition & 0 deletions PowerShellBuild/IB.tasks.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ task GenerateMarkdown -if (. $genMarkdownPreReqs) StageFiles,{
ModuleName = $PSBPreference.General.ModuleName
DocsPath = $PSBPreference.Docs.RootDir
Locale = $PSBPreference.Help.DefaultLocale
Overwrite = $PSBPreference.Docs.Overwrite
}
Build-PSBuildMarkdown @buildMDParams
}
Expand Down
6 changes: 5 additions & 1 deletion PowerShellBuild/Public/Build-PSBuildMarkdown.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ function Build-PSBuildMarkdown {
[string]$DocsPath,

[parameter(Mandatory)]
[string]$Locale
[string]$Locale,

[parameter(Mandatory)]
[bool]$Overwrite
)

$moduleInfo = Import-Module "$ModulePath/$ModuleName.psd1" -Global -Force -PassThru
Expand Down Expand Up @@ -57,6 +60,7 @@ function Build-PSBuildMarkdown {
OutputFolder = [IO.Path]::Combine($DocsPath, $Locale)
ErrorAction = 'SilentlyContinue'
Verbose = $VerbosePreference
Force = $Overwrite
}
New-MarkdownHelp @newMDParams > $null
} finally {
Expand Down
7 changes: 5 additions & 2 deletions PowerShellBuild/build.properties.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BuildHelpers\Set-BuildEnvironment -Force

$outDir = [IO.Path]::Combine($env:BHProjectPath, 'Output')
$outDir = [IO.Path]::Combine($env:BHProjectPath, 'Output')
$moduleVersion = (Import-PowerShellDataFile -Path $env:BHPSModuleManifest).ModuleVersion

[ordered]@{
Expand Down Expand Up @@ -97,7 +97,7 @@ $moduleVersion = (Import-PowerShellDataFile -Path $env:BHPSModuleManifest).Modul
OutputFileFormat = 'JaCoCo'
}
}
Help = @{
Help = @{
# Path to updateable help CAB
UpdatableHelpOutDir = [IO.Path]::Combine($outDir, 'UpdatableHelp')

Expand All @@ -111,6 +111,9 @@ $moduleVersion = (Import-PowerShellDataFile -Path $env:BHPSModuleManifest).Modul
Docs = @{
# Directory PlatyPS markdown documentation will be saved to
RootDir = [IO.Path]::Combine($env:BHProjectPath, 'docs')

# Overwrite existing markdown files and use comment based help as the source of truth
Overwrite = $true
}
Publish = @{
# PowerShell repository name to publish modules to
Expand Down
1 change: 1 addition & 0 deletions PowerShellBuild/psakeFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ task GenerateMarkdown -depends StageFiles -precondition $genMarkdownPreReqs {
ModuleName = $PSBPreference.General.ModuleName
DocsPath = $PSBPreference.Docs.RootDir
Locale = $PSBPreference.Help.DefaultLocale
Overwrite = $PSBPreference.Docs.Overwrite
}
Build-PSBuildMarkdown @buildMDParams
} -description 'Generates PlatyPS markdown files from module help'
Expand Down
182 changes: 104 additions & 78 deletions README.md

Large diffs are not rendered by default.