How does `MDBOOK_XXX` env deal with configuration strings with an undersore (`_`)?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 22.2k
- Forks
- 1.9k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 12
Description
Question
Recently, I tried to build Zed docs without using its custom preprocessor, [preprocessor.zed_docs_preprocessor].
Originally, I thought I could use MDBOOK_XXX env to disable it by assigning it with an empty object, {}, like this:
MDBOOK_PREPROCCESSOR__ZED_DOCS_PREPROCESSOR={} mdbook build docs
However, it failed because mdbook will recognize:
MDBOOK_PREPROCCESSOR__ZED_DOCS_PREPROCESSOR -> [preprocessor.zed-docs-preprocessor]
Based on the Environment Variables section:
Variables starting with
MDBOOK_are used for configuration. The key is created by removing theMDBOOK_prefix and turning the resulting string intokebab-case. Double underscores (__) separate nested keys, while a single underscore (_) is replaced with a dash (-).For example:
MDBOOK_foo->fooMDBOOK_FOO->fooMDBOOK_FOO__BAR->foo.barMDBOOK_FOO_BAR->foo-barMDBOOK_FOO_bar__baz->foo-bar.baz
It seems that mdbook's MDBOOK_XXX env can deal with configuration strings with a dash (-) and a dot (.), but it cannot deal with an underscore (_).
My questions are:
- If so, does it mean that it's not recommended to use
_in configuration strings? - If not, then how does
MDBOOK_XXXenv deal with configuration strings with_?
Version
mdbook v0.4.40
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 Environment Variables section linked in the issue and reproduce the command using MDBOOK_PREPROCCESSOR__ZED_DOCS_PREPROCESSOR with an empty object against mdBook v0.4.40. Trace how nested environment keys are converted to configuration keys, then document or correct the handling of underscores so the behavior and supported configuration names are clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100