Let `mdbook build` select renderer and preprocessors

Open
#1,978 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start with the mdbook build and mdbook serve command entry points and trace how renderers and preprocessors are selected from book.toml. Define command-line controls that enable or disable each for both commands, then verify that the normal workflow remains unchanged and that the translation workflow can activate them when needed.

Written by the indexing model from the issue text.

Description

I'm adding support for translations to https://github.com/google/comprehensive-rust/ — via the code I posted in #1864. My plan is to do this via a renderer and a preprocessor:

  • a mdbook-gettext renderer collects the text from the entire book and outputs a messages.pot file which is ready to be translated
  • a translate preprocessor uses a xx.po file (with translations) to translate the text on-the-fly into an output language.

Hooking into mdbook like this seems nice: I don't need to know about where the Markdown files are on disk and I can reuse things such as BookItem.

However, I don't need the renderer and the preprocessor most of the time: I only need them when publishing a new version. It would therefore be nice if mdbook build would have new command line options which lets me enable/disable the renderer and preprocessor.

Does that sound like a reasonable idea? I think mdbook serve should have the same options.

My workaround right now is to modify the book.toml file to enable the renderer and preprocessor when needed.

Dominant language
Rust
Stars
22.2k
Forks
1.9k
Avg merge
2d 21h
Merged PRs (30d)
12

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.

More from rust-lang/mdBook

All issues in rust-lang/mdBook

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.