Skip to content

Commit a8220bf

Browse files
committed
Examples for MdFormat-EscapePath and MdFormat-Link
1 parent 25e3a67 commit a8220bf

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

source/readme.build.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,29 @@ $find_pq = fd -e pq --base-directory (gi $Config.AppRoot )
9494
$Config.AppRoot
9595
)
9696
filter MdFormat-EscapePath {
97+
<#
98+
.SYNOPSIS
99+
make safe markdown style links. convert paths to work as urls and console clickable urls like: <file:///{0}>'
100+
.example
101+
> 'dir\some Item.md' | MdFormat-EscapePath
102+
103+
dir/some%20Item.md
104+
#>
97105
$_ -replace ' ', '%20' -replace '\\', '/'
98106
}
99107
function MdFormat-Link {
108+
<#
109+
.SYNOPSIS
110+
format a single markdown url with a name and value
111+
.EXAMPLE
112+
Pwsh> MdFormat-Link -Name 'go to' -Url 'some Item.md'
113+
114+
[go to](some Item.md)
115+
116+
MdFormat-Link -Name 'go to' -Url 'dir\some Item.md' -AlwaysEscapeUrlPath
117+
118+
[go to](dir/some%20Item.md)
119+
#>
100120
param(
101121
[Parameter(Mandatory)]
102122
[string]$Name,

0 commit comments

Comments
 (0)