alt3 / Docusaurus.Powershell

Docusaurus websites for PowerShell modules
https://docusaurus-powershell.vercel.app/
MIT License
28 stars 11 forks source link

Exception when Append/PrependMarkdown includes certain wildcard characters #160

Closed fflaten closed 1 year ago

fflaten commented 1 year ago

image

Exception is thrown by Test-Path here Can repro with same string using Test-Path in unix only (pester/docs devcontainer).

$t = @"
:::note This page was generated using the comment based help in Pester $($ModuleList.Pester).
To edit the content of this page, change the corresponding help in the [pester/pester](https://github.com/pester/pester)-repository.
:::
"@

Test-Path $t

Using Test-Path -LiteralPath $t doesn't throw, but maybe better to check if string is a path first? Haven't really identified the issue as you can solve it by any of these ways:

bravo-kernel commented 1 year ago

Would you mind just adding any of the solutions as you see fit?

Sent from my Mobile Device

Op 26 mrt. 2023 om 19:30 heeft Frode Flaten @.***> het volgende geschreven:



Exception is thrown by Test-Path here Can repro with same string using Test-Path in unix only (pester/docs devcontainer).

$t = @" :::note This page was generated using the comment based help in Pester $($ModuleList.Pester). To edit the content of this page, change the corresponding help in the pester/pester-repository. ::: "@

Test-Path $t Using Test-Path -LiteralPath $t doesn't throw, but maybe better to check if string is a path first? Haven't really identified the issue as you can solve it by any of these ways:

Remove ::: prefix Remove / in the link name Remove square brackets in link (which are wildcard chars, so that makes sense) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

bravo-kernel commented 1 year ago

If you have an example of how to check if string is really a path, let me know and I will make a new version.

fflaten commented 1 year ago

Was about to suggest Test-Path $t -IsValid, but it's actually true with ::: prefix which is probably why some provider-code with wildcard-support is executed.

You could maybe just catch the exception like suggested here: https://ss64.com/ps/test-path.html

bravo-kernel commented 1 year ago

Awesome, will add that when I find the time 👍 because while we are doing all this, I am also being flooded with this https://github.com/alt3/rank-my-wallet/blob/main/contributing.md#translations

bravo-kernel commented 1 year ago

Fix released with https://github.com/alt3/Docusaurus.Powershell/releases/tag/1.0.34. Thanks for the pointer 👍