rust-lang / rust-lang/mdBook

Add input in mdbook to rebuild

Open
#2,456 2 comments 1 reaction 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

This is specifically focused on the new test support in mdbook-spec, but in general, mdbook serve does not check for files outside of the watch tree (src/ dir + include entries), and there's no way to force it to rebuild without SIGINTing and rerunning the command. In the case of mdbook-spec, this means that it doesn't watch the thousands (10,000s) of test files for updates.

Proposed Solution

A terminal keystroke, such as ^R (Control+R), could be checked for while listening to changes, and when read from stdin, rebuild the book and trigger a rebuild.

Notes

An alternative on unix specifically is to listen to a particular signal. However, neither of the two signals designed for an arbitrary purpose are triggered by a keystroke.

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 at the mdbook serve implementation, focusing on its change-listening loop and how it handles terminal input. Determine how a Control+R keystroke can trigger a rebuild without restarting the command, then verify that rebuilding works for files outside the watch tree, including mdbook-spec test files.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.