rust-lang / rust-lang/mdBook

Add drop down menu to allow user to select a font (and possibly other settings)

Open
#3,165 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.