Add drop down menu to allow user to select a font (and possibly other settings)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 22.2k
- Forks
- 1.9k
- PR merge metrics
- PR metrics pending
Description
Problem
For user preference and for accessibility it might be beneficial to be able to display mdBook content in different fonts. OpenDyslexic and OpenDyslexicMono being (to me) the best known fonts people might like to switch to. A drop down menu next to the theme button could be added to give a drop down menu to select a choice of font for HTML output.
Proposed Solution
I've implemented what should be a MWE at https://github.com/ALEX-CASSON-LAB/mdBook/tree/toggle-font for my own purposes. It can switch between 4 different fonts. It's basically a copy of the theme switching .hbs and .js, with some additional fonts also stored. It adds a default_font setting to book.toml to set which of the 4 fonts is selected by default.
Notes
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing theme-switching .hbs and .js files, then inspect how book.toml settings affect HTML output. Compare the proposed toggle-font implementation and determine how the default_font setting and four font choices should integrate. Done means users can select a font from the dropdown and the configured default is honored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- handlebars, html, javascript, rust
- Domain
- accessibility, frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100