platyPS icon indicating copy to clipboard operation
platyPS copied to clipboard

Improve Example output formatting

Open roberttoups opened this issue 5 years ago • 4 comments

The current formatting does not tag the code block as PowerShell. The remarks attribute sometimes is the formatted output of the example which is not within the code block. If there is a new line between the command example and the output of the command in the ".EXAMPLE", the output is considered remarks and will be unformatted by the current implementation. This provides, subjectively, a more esthetic output.

Here are examples of the output: https://github.com/roberttoups/IPv4Toolbox/blob/master/Docs/Invoke-IPv4ListSort.md https://github.com/roberttoups/IPv4Toolbox/blob/master/Docs/Get-SubnetInformation.md

roberttoups avatar Jan 16 '21 04:01 roberttoups

I forgot to add there is a side benefit to improving the output of the New-ExternalHelp XML for the code examples.

roberttoups avatar Jan 16 '21 04:01 roberttoups

@roberttoups Can you add a screenshot for before / after the change?

adityapatwardhan avatar May 04 '21 22:05 adityapatwardhan

Get-SubnetInformation-After.pdf Get-SubnetInformation-Before.pdf @adityapatwardhan These are rendered to PDF by Typora. The "Before" PDF is the output for the latest platyPS from the Gallery. The "After" is my modification.

roberttoups avatar May 05 '21 22:05 roberttoups

Although the code doesn't indicate a change to this, the pdf's have a different title. Think the old title of the examples were better, would rather have it accept a title. Maybe this needs to be fixed on the "backend" too, so that the engine itself supports it having a title when writing the comment based docs:

<#
    .EXAMPLE Adding a title to the example
    ...

    .EXAMPLE Showing more examples with titles
    ...
#>
...
## Examples

### Example 1: Adding a title to the example
...

### Example 2: Showing more examples with titles
...

Opened a separate issue on it: #627

MariusStorhaug avatar Mar 25 '24 11:03 MariusStorhaug