Skip to content

Commit 3698475

Browse files
committed
feat: Icon support in MF + backwards compatability
1 parent 713be80 commit 3698475

File tree

8 files changed

+9336
-4
lines changed

8 files changed

+9336
-4
lines changed

assets/css/v2/style.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1513,6 +1513,18 @@ hr {
15131513
margin: 0;
15141514
}
15151515

1516+
.lucide {
1517+
width: 1.5rem;
1518+
height: 1.5rem;
1519+
stroke: currentColor;
1520+
fill: none;
1521+
stroke-width: 2;
1522+
stroke-linecap: square;
1523+
stroke-linejoin: square;
1524+
vertical-align: sub;
1525+
margin: 0;
1526+
}
1527+
15161528
/* FILTHY HACKS BEGIN */
15171529

15181530
/* Override logo with black text version */
@@ -1533,7 +1545,6 @@ hr {
15331545
}
15341546

15351547
/* FILTHY HACKS END */
1536-
15371548
/* Hidden temporarily */
15381549

15391550
.code-copy {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
description: Lucide icon usage
3+
title: Lucide
4+
weight: 300
5+
toc: true
6+
---
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
description: Where lucide icons are allowed to be used
3+
title: Permitted usage
4+
weight: 100
5+
---
6+
7+
[Lucide Icons](https://lucide.dev/) is a free icon library with a permissive license (MIT). We use it for our minimal icon needs in place of FontAwesome in Oldframe.
8+
9+
{{<fe "book-headphones">}}
10+
11+
[Lucide link{{<fe "circle">}}](#)
12+
13+
{{<fe "circle">}} in text.
14+
15+
<i class="fas fa-shield"></i>
16+
{{<warning>}}
17+
This is a Warning callout. There was previously a bug with **bold text** that we should be aware of and continue to check for. This callout was invoked with the `<warning>` shortcode. It has no custom title. {{<fe "octagon-alert">}}
18+
{{</warning>}}

layouts/_default/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
{{ if or ( not hugo.IsServer ) ( not ( in .Site.Params.buildtype "package" ) ) }}
167167
{{ partial "universal-tag.html" . }}
168168
{{ end }}
169-
169+
170170
<header>
171171
{{ block "header" . }}{{end}}
172172
</header>

layouts/_default/docs.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
{{ partial "sidebar.html" . }}
66
</nav>
77

8+
{{$content := .Content}}
9+
{{$pattern := `<i class="fas fa-([^\"]+)"></i>`}}
10+
{{$matches := findRE $pattern $content}}
11+
{{range $matches}}
12+
{{$iconName := replaceRE $pattern "$1" .}}
13+
{{$iconHTML := partial "lucide" (dict "context" $ "icon" $iconName)}}
14+
{{$content = replace $content . $iconHTML}}
15+
{{end}}
816

917
{{if (.Params.catalog) }}
1018
<main class="content content-has-toc" role="main">
@@ -31,7 +39,7 @@
3139
{{ end }}
3240
</section>
3341
<h1>{{ .Title }}</h1>
34-
{{ .Content }}
42+
{{ $content | safeHTML }}
3543
{{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }}
3644
{{ if in .Params.doctypes "beta" }}{{ partial "beta-badge" . }}{{ end }}
3745

layouts/partials/lucide.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{- /* Usage: */ -}}
2+
{{- /* (dict "context" . "icon" "circle") */ -}}
3+
<svg class="lucide" >
4+
<use href="/images/lucide-sprite.svg#{{ .icon }}"></use>
5+
</svg>

layouts/shortcodes/fe.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
{{ partial "feather" (dict "context" . "icon" (.Get 0)) }}
1+
<!-- {{ partial "feather" (dict "context" . "icon" (.Get 0)) }} -->
2+
{{ partial "lucide" (dict "context" . "icon" (.Get 0)) }}

0 commit comments

Comments
 (0)