Skip to content

Commit 4bac548

Browse files
authored
Merge pull request #1330 from notriddle/embed-svg
Use embedded SVG instead of fonts for icons, font-awesome 6.2
2 parents 7b3e697 + 2dc8c5e commit 4bac548

24 files changed

+238
-2769
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ clap = { version = "4.5.41", features = ["cargo", "wrap_help"] }
3333
clap_complete = "4.5.55"
3434
elasticlunr-rs = "3.0.2"
3535
env_logger = "0.11.8"
36+
font-awesome-as-a-crate = "0.3.0"
3637
futures-util = "0.3.31"
3738
handlebars = "6.3.2"
3839
hex = "0.4.3"

crates/mdbook-html/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ rust-version.workspace = true
1111
ammonia = { workspace = true, optional = true }
1212
anyhow.workspace = true
1313
elasticlunr-rs = { workspace = true, optional = true }
14+
font-awesome-as-a-crate.workspace = true
1415
handlebars.workspace = true
1516
hex.workspace = true
1617
log.workspace = true

crates/mdbook-html/front-end/css/chrome.css

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ html.sidebar-visible #menu-bar {
5656
#menu-bar.bordered {
5757
border-block-end-color: var(--table-border-color);
5858
}
59-
#menu-bar i, #menu-bar .icon-button {
59+
#menu-bar .fa-svg, #menu-bar .icon-button {
6060
position: relative;
6161
padding: 0 8px;
6262
z-index: 10;
@@ -65,7 +65,7 @@ html.sidebar-visible #menu-bar {
6565
transition: color 0.5s;
6666
}
6767
@media only screen and (max-width: 420px) {
68-
#menu-bar i, #menu-bar .icon-button {
68+
#menu-bar .fa-svg, #menu-bar .icon-button {
6969
padding: 0 5px;
7070
}
7171
}
@@ -76,7 +76,7 @@ html.sidebar-visible #menu-bar {
7676
padding: 0;
7777
color: inherit;
7878
}
79-
.icon-button i {
79+
.icon-button .fa-svg {
8080
margin: 0;
8181
}
8282

@@ -118,14 +118,14 @@ html:not(.js) .left-buttons button {
118118
.mobile-nav-chapters,
119119
.mobile-nav-chapters:visited,
120120
.menu-bar .icon-button,
121-
.menu-bar a i {
121+
.menu-bar a .fa-svg {
122122
color: var(--icons);
123123
}
124124

125-
.menu-bar i:hover,
125+
.menu-bar .fa-svg:hover,
126126
.menu-bar .icon-button:hover,
127127
.nav-chapters:hover,
128-
.mobile-nav-chapters i:hover {
128+
.mobile-nav-chapters .fa-svg:hover {
129129
color: var(--icons-hover);
130130
}
131131

@@ -240,13 +240,10 @@ pre > .buttons :hover {
240240
border-color: var(--icons-hover);
241241
background-color: var(--theme-hover);
242242
}
243-
pre > .buttons i {
244-
margin-inline-start: 8px;
245-
}
246243
pre > .buttons button {
247244
cursor: inherit;
248245
margin: 0px 5px;
249-
padding: 4px 4px 3px 5px;
246+
padding: 2px 3px 0px 4px;
250247
font-size: 23px;
251248

252249
border-style: solid;
@@ -365,6 +362,20 @@ mark.fade-out {
365362
background-color: var(--bg);
366363
}
367364

365+
#fa-spin {
366+
animation: rotating 2s linear infinite;
367+
display: inline-block;
368+
}
369+
370+
@keyframes rotating {
371+
from {
372+
transform: rotate(0deg);
373+
}
374+
to {
375+
transform: rotate(360deg);
376+
}
377+
}
378+
368379
#searchbar {
369380
width: 100%;
370381
margin-block-start: var(--searchbar-margin-block-start);

crates/mdbook-html/front-end/css/font-awesome.min.css

Lines changed: 0 additions & 4 deletions
This file was deleted.

crates/mdbook-html/front-end/css/general.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,10 @@ sup {
278278
.result-no-output {
279279
font-style: italic;
280280
}
281+
282+
.fa-svg svg {
283+
width: 1em;
284+
height: 1em;
285+
fill: currentColor;
286+
margin-bottom: -0.1em;
287+
}
Binary file not shown.
Binary file not shown.

crates/mdbook-html/front-end/fonts/fontawesome-webfont.svg

Lines changed: 0 additions & 2671 deletions
This file was deleted.
Binary file not shown.

0 commit comments

Comments
 (0)