diff --git a/CHANGELOG.md b/CHANGELOG.md index 53c02a3107..560bef26b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,7 +75,7 @@ The following is a summary of the changes that may require your attention when u - Updated to a newer version of `pulldown-cmark`. This brings a large number of fixes to markdown processing. [#2401](https://github.com/rust-lang/mdBook/pull/2401) -- The font-awesome font is no longer loaded as a font. Instead, the corresponding SVG is embedded in the output for the corresponding `` tags. Additionally, a handlebars helper has been added for the `hbs` files. +- The font-awesome font is no longer loaded as a font. Instead, the corresponding SVG is embedded in the output for the corresponding `` tags. Additionally, a handlebars helper has been added for the `hbs` files. This also updates the version from 4.7.0 to 6.2.0, which means some of the icon names and styles have changed. Most of the free icons are in the "solid" set. See the [free icon set](https://fontawesome.com/v6/search) for the available icons. [#1330](https://github.com/rust-lang/mdBook/pull/1330) - Changed all internal HTML IDs to have an `mdbook-` prefix. This helps avoid namespace conflicts with header IDs. [#2808](https://github.com/rust-lang/mdBook/pull/2808) diff --git a/crates/mdbook-html/src/html/tree.rs b/crates/mdbook-html/src/html/tree.rs index 0c7c2e4d10..5cb97ce378 100644 --- a/crates/mdbook-html/src/html/tree.rs +++ b/crates/mdbook-html/src/html/tree.rs @@ -1030,14 +1030,14 @@ where let i_el = node.value().as_element().unwrap(); let classes = i_el.attr("class").unwrap_or_default(); for class in classes.split(" ") { - if let Some(class) = class.strip_prefix("fa-") { - icon = class.to_owned(); - } else if class == "fa" { + if matches!(class, "fa" | "fa-regular") { type_ = fa::Type::Regular; - } else if class == "fas" { + } else if matches!(class, "fas" | "fa-solid") { type_ = fa::Type::Solid; - } else if class == "fab" { + } else if matches!(class, "fab" | "fa-brands") { type_ = fa::Type::Brands; + } else if let Some(class) = class.strip_prefix("fa-") { + icon = class.to_owned(); } else { new_classes += " "; new_classes += class; diff --git a/guide/src/format/configuration/renderers.md b/guide/src/format/configuration/renderers.md index ae0b724a4b..22dfd425fb 100644 --- a/guide/src/format/configuration/renderers.md +++ b/guide/src/format/configuration/renderers.md @@ -143,9 +143,7 @@ The following configuration options are available: those labels. Defaults to `false`. - **git-repository-url:** A url to the git repository for the book. If provided an icon link will be output in the menu bar of the book. -- **git-repository-icon:** The FontAwesome icon class to use for the git - repository link. Defaults to `fab-github` which looks like . - If you are not using GitHub, another option to consider is `fa-code-fork` which looks like . +- **git-repository-icon:** The Font Awesome icon class to use for the git repository link. Defaults to `fab-github` which looks like . If you are not using GitHub, another option to consider is `fas-code-fork` which looks like . The start of the string should be `fa-` for regular icons, `fas-` for solid icons, or `fab-` for brand icons. See the [free icon set](https://fontawesome.com/v6/search) for the available icons. - **edit-url-template:** Edit url template, when provided shows a "Suggest an edit" button (which looks like ) for directly jumping to editing the currently viewed page. For e.g. GitHub projects set this to diff --git a/guide/src/format/mdbook.md b/guide/src/format/mdbook.md index ff63eb43a9..9401107eb2 100644 --- a/guide/src/format/mdbook.md +++ b/guide/src/format/mdbook.md @@ -340,7 +340,7 @@ HTML tags with class `hidden` will not be shown. ## Font-Awesome icons -mdBook includes a copy of [Font Awesome Free's](https://fontawesome.com) +mdBook includes a copy of version 6 of [Font Awesome Free's](https://fontawesome.com) MIT-licensed SVG files. It emulates the `` syntax, but converts the results to inline SVG. Only the regular, solid, and brands icons are included; paid features like the light icons are not. @@ -348,7 +348,9 @@ features like the light icons are not. For example, given this HTML syntax: ```hbs -The result looks like this: +The result looks like this: ``` -The result looks like this: +The result looks like this: + +See the [free icon set](https://fontawesome.com/v6/search) for the available icons. diff --git a/guide/src/format/theme/index-hbs.md b/guide/src/format/theme/index-hbs.md index 16e14b2c07..35e8b03637 100644 --- a/guide/src/format/theme/index-hbs.md +++ b/guide/src/format/theme/index-hbs.md @@ -95,7 +95,7 @@ MIT-licensed SVG files. It accepts three positional arguments: 1. Type: one of "solid", "regular", and "brands" (light and duotone are not currently supported) 2. Icon: anything chosen from the - [free icon set](https://fontawesome.com/icons?d=gallery&m=free) + [free icon set](https://fontawesome.com/v6/search) 3. ID (optional): if included, an HTML ID attribute will be added to the icon's wrapping `` tag diff --git a/tests/testsuite/rendering/fontawesome/expected/fa.html b/tests/testsuite/rendering/fontawesome/expected/fa.html index a2f9d4236e..6dfc9de1f8 100644 --- a/tests/testsuite/rendering/fontawesome/expected/fa.html +++ b/tests/testsuite/rendering/fontawesome/expected/fa.html @@ -3,4 +3,5 @@

Chapter 1

Text prevents translation.

-

\ No newline at end of file +

+

\ No newline at end of file diff --git a/tests/testsuite/rendering/fontawesome/src/fa.md b/tests/testsuite/rendering/fontawesome/src/fa.md index 2f934da18d..1764c91085 100644 --- a/tests/testsuite/rendering/fontawesome/src/fa.md +++ b/tests/testsuite/rendering/fontawesome/src/fa.md @@ -9,3 +9,5 @@ Text prevents translation. + +