Merge pull request #700 from Icinga:feature/improve_docs_with_multiline_and_pipe_support

Feature: Adds support to use pipes and multi lines for plugin documentation
This commit is contained in:
Lord Hepipud 2024-03-22 12:11:31 +01:00 committed by GitHub
commit 751e17f4c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 4 deletions

View file

@ -35,6 +35,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#693](https://github.com/Icinga/icinga-powershell-framework/pull/693) Adds new command `Restart-Icinga` to restart both, the Icinga Agent and Icinga for Windows
* [#694](https://github.com/Icinga/icinga-powershell-framework/pull/694) Adds support for check objects not being added to summary header
* [#695](https://github.com/Icinga/icinga-powershell-framework/pull/695) Adds security hardening to JEA profiles by always prohibit certain cmdlets
* [#700](https://github.com/Icinga/icinga-powershell-framework/pull/700) Adds feature to support using pipes and multi lines for plugin documentation
## 1.11.1 (2023-11-07)

View file

@ -126,10 +126,17 @@ function Publish-IcingaPluginDocumentation()
foreach ($parameter in $PluginHelp.parameters.parameter) {
[string]$ParamDescription = $parameter.description.Text;
if ([string]::IsNullOrEmpty($ParamDescription) -eq $FALSE) {
$ParamDescription = $ParamDescription.Replace("`r`n", ' ');
$ParamDescription = $ParamDescription.Replace("`r", ' ');
$ParamDescription = $ParamDescription.Replace("`n", ' ');
$ReplacementString = '<br /> ';
$ParamDescription = $ParamDescription.Replace("`r`n", $ReplacementString);
$ParamDescription = $ParamDescription.Replace("`r", $ReplacementString);
$ParamDescription = $ParamDescription.Replace("`n", $ReplacementString);
if ($ParamDescription.Contains('|')) {
$ParamDescription = $ParamDescription.Replace('|', '&#124;');
}
}
[string]$TableContent = [string]::Format(
'| {0} | {1} | {2} | {3} | {4} |',
$parameter.name,

View file

@ -376,11 +376,19 @@ function Get-IcingaCheckCommandConfig()
$IcingaDataType = [string]::Format('Icinga\Module\Director\DataType\DataType{0}', $IcingaDataType)
if ($Basket.Datafield.Values.varname -ne $IcingaCustomVariable) {
$DataFieldDescription = $parameter.Description.Text;
# Remove HTML code tags and replace them with markdown tags
if ([string]::IsNullOrEmpty($DataFieldDescription) -eq $FALSE) {
$DataFieldDescription = $DataFieldDescription.Replace('<pre>', '```');
$DataFieldDescription = $DataFieldDescription.Replace('</pre>', '```');
}
$Basket.Datafield.Add(
[string]$FieldID, @{
'varname' = $IcingaCustomVariable;
'caption' = $parameter.Name;
'description' = $parameter.Description.Text;
'description' = $DataFieldDescription;
'datatype' = $IcingaDataType;
'format' = $NULL;
'originalId' = [string]$FieldID;