Open mgeisler opened 1 year ago
I found a better work-around: use the MDBOOK_
environment variable to override the renderer and preprocessor as needed.
With that, I think this issue can be closed.
We had a discussion in https://github.com/google/comprehensive-rust/pull/1998 about a similar topic: how can we include configuration for a renderer (mdbook-pandoc in this case) without requiring that everybody installs the dependencies for the renderer?
One solution would be to let mdbook build
and serve
take a list of renderer to use. That would be a subset of the renderers configured in book.toml
.
Another solution just occurred to me: we could extract the configuration that isn't used all the time to a separate file. When we want to use it, we do something like
MDBOOK_OUTPUT=$(cat pandoc.json) mdbook build
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:
mdbook-gettext
renderer collects the text from the entire book and outputs amessages.pot
file which is ready to be translatedtranslate
preprocessor uses axx.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.