Skip to content

Use embedded SVG instead of fonts for icons, font-awesome 6.2 #1330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

notriddle
Copy link
Contributor

@notriddle notriddle commented Sep 15, 2020

The downsides of icon fonts are well-documented, and also, why ship all of the icons when it only uses 14?

Note: font-awesome-as-a-crate 0.2.0 requires Rust 1.49.0, because it performs pattern matching on byte slices in a const fn. See rust-lang/docs.rs#1573

@ehuss
Copy link
Contributor

ehuss commented Sep 18, 2020

Thanks for the PR! I don't think this is something we can land right away, because I believe there are books that are using the FA icons, and this would break them. I'll try to review it when I get a chance, but merging may need to wait until the next major release.

@notriddle
Copy link
Contributor Author

notriddle commented Sep 18, 2020

That’s fine. mdBook is still 0.4, so it can still release a 0.5 some time.

Also, I should probably document the fa handlebars helper in the manual. Since this is how it’s going to be done now. Should we also add some sort of Markdown pass for icons inline with the book?

@notriddle
Copy link
Contributor Author

@ehuss Docs and inline fixup for fontawesome icons have been added to the HTML renderer, so that books using font-awesome will still be able to do so.

@Dylan-DPC-zz Dylan-DPC-zz added the Breaking Change This would require a SemVer breaking change label Mar 11, 2021
@notriddle notriddle force-pushed the embed-svg branch 2 times, most recently from de13cfa to 96c3719 Compare April 14, 2021 22:20
@notriddle notriddle force-pushed the embed-svg branch 2 times, most recently from 3bdc201 to 9b0ccfb Compare December 23, 2021 21:20
@notriddle
Copy link
Contributor Author

@ehuss Now that the fixups are included to allow books that already use font-awesome to continue doing so, and the documentation is written, is there anything else preventing this from being included in the 0.5.0 milestone?

@notriddle notriddle changed the title Use embedded SVG instead of fonts for icons Use embedded SVG instead of fonts for icons, font-awesome 6.2 Sep 18, 2022
@ehuss ehuss added this to the 0.5 milestone Jan 15, 2023
@notriddle notriddle force-pushed the embed-svg branch 2 times, most recently from 4cb13c6 to 8763755 Compare June 8, 2024 21:19
@uncenter
Copy link

Is there interest in reviving this pull request? I can try to bring these changes up to date with the latest in the repository... 👀

@Dylan-DPC
Copy link
Member

Is there interest in reviving this pull request? I can try to bring these changes up to date with the latest in the repository... 👀

@uncenter yes if you can that would be helpful. Thanks

@rustbot
Copy link
Collaborator

rustbot commented Apr 30, 2025

☔ The latest upstream changes (possibly #2681) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Apr 30, 2025
@ehuss
Copy link
Contributor

ehuss commented Aug 10, 2025

@notriddle I rebased and tried to update things. I think I mostly got everything going, but I noticed two issues:

  • The spinner (for loading search index) doesn't animate.
  • The spacing of the buttons on code blocks doesn't look right.

I ran out of time today to investigate that more. Do you offhand know what's up with the spinner animation?

@notriddle
Copy link
Contributor Author

To fix the spinner animation, this code needs added to the general.css file:

.fa-spin {
	animation: rotating 2s linear infinite;
}

@keyframes rotating {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

The fontawesome package happens to include this utility class. Since it's not there any more, we need to provide it ourselves.

The [downsides of icon fonts] are well-documented, and also, why ship all of
the icons when it only uses 14?

[downsides of icon fonts]: https://speakerdeck.com/ninjanails/death-to-icon-fonts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change This would require a SemVer breaking change S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants