Skip to content

Commit 2901223

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

File tree

7 files changed

+9352
-3
lines changed

7 files changed

+9352
-3
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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
Here are some icons that are using font-awesome but should be backwards compatible:
16+
<i class="fa-solid fa-check" style="color:green"></i>
17+
<i class="fa fa-circle"></i>
18+
{{<warning>}}
19+
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">}}
20+
{{</warning>}}

layouts/_default/docs.html

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

8+
{{$content := .Content}}
9+
{{$pattern := `<i[^>]*class=["'][^"']*(?:fas?|fa-solid|fa-regular|fa-brands)\s+fa-([^"'\s]+)[^"']*["'][^>]*?(?:\s+style=["']([^"']*)["'])?[^>]*></i>`}}
10+
{{$matches := findRE $pattern $content}}
11+
12+
{{range $matches}}
13+
{{$currentMatch := .}}
14+
{{$iconName := ""}}
15+
{{$styleAttr := ""}}
16+
17+
{{$submatches := findRESubmatch $pattern $currentMatch}}
18+
{{if gt (len $submatches) 0}}
19+
{{$iconName = index (index $submatches 0) 1}}
20+
{{$styleAttr = index (index $submatches 0) 2}}
21+
22+
{{$iconHTML := partial "lucide" (dict
23+
"context" $
24+
"icon" $iconName
25+
"style" $styleAttr
26+
)}}
27+
28+
{{$content = replace $content $currentMatch $iconHTML}}
29+
{{end}}
30+
{{end}}
31+
832

933
{{if (.Params.catalog) }}
1034
<main class="content content-has-toc" role="main">
@@ -31,7 +55,7 @@
3155
{{ end }}
3256
</section>
3357
<h1>{{ .Title }}</h1>
34-
{{ .Content }}
58+
{{ $content | safeHTML }}
3559
{{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }}
3660
{{ if in .Params.doctypes "beta" }}{{ partial "beta-badge" . }}{{ end }}
3761

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" style="{{ .style }}">
4+
<use href="/images/lucide-sprite.svg#{{ .icon }}"></use>
5+
</svg>

layouts/shortcodes/fe.html

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

0 commit comments

Comments
 (0)