Skip to content

Commit 6584f67

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: OpenPackage.View.FeatherIcon.svg ( Fixes #203 )
1 parent 6f4a3e3 commit 6584f67

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

OP.types.ps1xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8201,6 +8201,42 @@ filter at.markpub.markdown {
82018201
}
82028202
</Script>
82038203
</ScriptMethod>
8204+
<ScriptMethod>
8205+
<Name>FeatherIcon.svg</Name>
8206+
<Script>
8207+
&lt;#
8208+
.SYNOPSIS
8209+
Views Feather Icons
8210+
.DESCRIPTION
8211+
Shows a feather icon.
8212+
.NOTES
8213+
Icons will be cached in memory to avoid repeated CDN requests.
8214+
.EXAMPLE
8215+
$site.Includes.Feather "clipboard"
8216+
.LINK
8217+
https://feathericons.com/
8218+
#&gt;
8219+
param(
8220+
[string]
8221+
$Icon = 'chevron-right',
8222+
8223+
[uri]
8224+
$FeatherCDN = "https://cdn.jsdelivr.net/gh/feathericons/feather@latest/icons/"
8225+
)
8226+
8227+
if (-not $script:FeatherIconCache) {
8228+
$script:FeatherIconCache = [Ordered]@{}
8229+
}
8230+
$icon = $icon.ToLower() -replace '\.svg$'
8231+
8232+
if (-not $script:FeatherIconCache[$icon]) {
8233+
$script:FeatherIconCache[$icon] = Invoke-RestMethod "$FeatherCDN/$Icon.svg"
8234+
}
8235+
8236+
$script:FeatherIconCache[$icon].OuterXml
8237+
8238+
</Script>
8239+
</ScriptMethod>
82048240
<ScriptMethod>
82058241
<Name>Markdown.html</Name>
82068242
<Script>

0 commit comments

Comments
 (0)