Skip to content

Commit 03e4b8a

Browse files
fix(deps): use Lucide icons for admonitions (#444)
1 parent 8f27bf1 commit 03e4b8a

12 files changed

Lines changed: 64 additions & 53 deletions

‎_config_theme.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ site-css:
7272
site-js:
7373
- href: "https://cdn.jsdelivr.net/npm/@lizardbyte/shared-web@2026.812.190302/dist/crowdin.js"
7474
- "/assets/js/crowdin-init.js"
75+
- href: "https://cdn.jsdelivr.net/npm/lucide@1.41.0/dist/umd/lucide.min.js"
76+
- "/assets/js/lucide-init.js"
7577
- "/assets/js/tabs.js"
7678
theme-switcher: true
7779
theme-switcher-style: 'button'

‎_data/licenses.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ jekyll:
4141
name: Jekyll
4242
url: https://jekyllrb.com/
4343
license: MIT
44+
lucide:
45+
name: Lucide
46+
# renovate: datasource=npm depName=lucide
47+
version: '1.41.0'
48+
url: https://lucide.dev/
49+
license: ISC
4450
marked:
4551
name: Marked
4652
# renovate: datasource=cdnjs depName=marked packageName=marked/lib/marked.umd.min.js versioning=semver

‎_includes/admonition.html‎

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,34 @@
44

55
{% if include.type.size > 0 and include.body.size > 0 %}
66
{% assign types = "
7-
attention:Attention,
8-
caution:Caution,
9-
danger:Danger,
10-
error:Error,
11-
hint:Hint,
12-
important:Important,
13-
note:Note,
14-
seealso:See also,
15-
tip:Tip,
16-
todo: TODO,
17-
warning:Warning" | split: "," %}
18-
{% assign title = include.title | default: "" %}
19-
{% if title == "" %}
20-
{% for type in types %}
21-
{% assign typeKeyVal = type | split: ":" %}
22-
{% assign typeKey = typeKeyVal[0] | strip %}
23-
{% assign typeValue = typeKeyVal[1] | strip %}
24-
{% if typeKey == include.type %}
25-
{% assign title = typeValue %}
7+
attention:Attention:triangle-alert,
8+
caution:Caution:shield-alert,
9+
danger:Danger:octagon-alert,
10+
error:Error:circle-x,
11+
hint:Hint:circle-question-mark,
12+
important:Important:flame,
13+
note:Note:pencil,
14+
seealso:See also:book-open,
15+
tip:Tip:lightbulb,
16+
todo:TODO:list-checks,
17+
warning:Warning:triangle-alert" | split: "," %}
18+
{% assign title = include.title | default: "" %}
19+
{% assign icon = "" %}
20+
{% for type in types %}
21+
{% assign typeKeyVal = type | split: ":" %}
22+
{% assign typeKey = typeKeyVal[0] | strip %}
23+
{% if typeKey == include.type %}
24+
{% assign icon = typeKeyVal[2] | strip %}
25+
{% if title == "" %}
26+
{% assign title = typeKeyVal[1] | strip %}
2627
{% endif %}
27-
{% endfor %}
28-
{% endif %}
28+
{% endif %}
29+
{% endfor %}
2930
<div class="admonition {{ include.type }} rounded">
30-
<p class="admonition-title">{{ title }}</p>
31+
<p class="admonition-title">
32+
{% if icon != "" %}<i data-lucide="{{ icon }}" aria-hidden="true"></i>{% endif %}
33+
{{ title }}
34+
</p>
3135
<p>
3236
{{ include.body | markdownify }}
3337
</p>

‎_sass/admonition.scss‎

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,18 @@ $admonitions-dark:
3333
;
3434

3535
$admonitions:
36-
//class (type), icon filename, icon/border color
37-
// TODO: Can we use font-awesome directly without keeping the svg files in our repo?
38-
('attention', 'exclamation-triangle-solid.svg', '#ff5252')
39-
('caution', 'bolt-solid.svg', '#ff9100')
40-
('danger', 'bolt-solid.svg', '#ff5252')
41-
('error', 'times-circle-solid.svg', '#ff5252')
42-
('hint', 'question-circle-solid.svg', '#00c953')
43-
('important', 'fire-solid.svg', '#ff9100')
44-
('note', 'pen-solid.svg', '#00b0ff')
45-
('seealso', 'info-circle-solid.svg', '#00b0ff')
46-
('tip', 'info-circle-solid.svg', '#00c953')
47-
('todo', 'pen-solid.svg', '#9e9e9e')
48-
('warning', 'exclamation-triangle-solid.svg', '#ff9100')
36+
// class (type), icon/border color
37+
('attention', '#ff5252')
38+
('caution', '#ff9100')
39+
('danger', '#ff5252')
40+
('error', '#ff5252')
41+
('hint', '#00c953')
42+
('important', '#ff9100')
43+
('note', '#00b0ff')
44+
('seealso', '#00b0ff')
45+
('tip', '#00c953')
46+
('todo', '#9e9e9e')
47+
('warning', '#ff9100')
4948
;
5049
.admonition {
5150
margin: 1.5625em 0;
@@ -71,28 +70,23 @@ $admonitions:
7170
color: #212529;
7271
}
7372

74-
.admonition-title::before {
73+
.admonition .admonition-title svg {
74+
color: $primary-color;
75+
display: inline-block;
7576
margin-right: .5rem;
7677
width: 1.2rem;
7778
height: 1.2rem;
78-
display: inline-block;
79-
content: '';
80-
-webkit-mask-size: cover;
81-
mask-size: cover;
82-
background-color: $primary-color;
8379
vertical-align: text-bottom;
8480
}
85-
@each $name, $icon, $icon-color in $admonitions {
81+
@each $name, $icon-color in $admonitions {
8682
@if $icon-color {
8783
.admonition.#{$name} {
8884
border-left-color: #{$icon-color};
8985
}
9086
}
91-
.admonition.#{$name} .admonition-title::before {
92-
-webkit-mask: url("/assets/img/icons/#{$icon}") no-repeat 50% 50%;
93-
mask: url("/assets/img/icons/#{$icon}") no-repeat 50% 50%;
87+
.admonition.#{$name} .admonition-title svg {
9488
@if $icon-color {
95-
background-color: #{$icon-color};
89+
color: #{$icon-color};
9690
}
9791
}
9892
}

‎assets/img/icons/bolt-solid.svg‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎assets/img/icons/exclamation-triangle-solid.svg‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎assets/img/icons/fire-solid.svg‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎assets/img/icons/info-circle-solid.svg‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎assets/img/icons/pen-solid.svg‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎assets/img/icons/question-circle-solid.svg‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)