Configuring mkdocs plugins from toml
See original GitHub issueI am trying to configure a plugin for mkdocs, but I’m running into some issues in translating the yaml over to toml. Basically, what I want is to specify something similar to what this yaml snippet does:
plugins:
- foo:
- bar
- search:
lang: en
But as far as I can tell that won’t work, since TOML does not support mixed type arrays.
I also tried the approach used in configuring the nav-bar (ie. nested tables):
[[tool.portray.mkdocs.plugins.foo]]
[[tool.portray.mkdocs.plugins.bar]]
[[tool.portray.mkdocs.plugins.search]]
lang = "en"
but this failed, since mkdocs appears to expect an array and not a table:
MkDocs[('plugins', ValidationError('Invalid Plugins configuration. Expected a list of plugins'))]
Traceback (most recent call last):
File "~/.pyenv/versions/3.7.4/bin/portray", line 10, in <module>
sys.exit(__hug__.cli())
File "~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/hug/api.py", line 441, in __call__
result = self.commands.get(command)()
File "~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/hug/interface.py", line 649, in __call__
raise exception
File "~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/hug/interface.py", line 645, in __call__
result = self.output(self.interface(**pass_to_function), context)
File "~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/hug/interface.py", line 129, in __call__
return __hug_internal_self._function(*args, **kwargs)
File "~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/portray/api.py", line 88, in server
with render.documentation_in_temp_folder(project_config) as doc_folder:
File "~/.pyenv/versions/3.7.4ontextlib.py", line 112, in __enter__
return next(self.gen)
File "~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/portray/render.py", line 156, in documentation_in_temp_folder
mkdocs(config["mkdocs"])
File "~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/portray/render.py", line 70, in mkdocs
config_instance = _mkdocs_config(config)
File "~/.pyenv/versions/3.7.4/lib/python3.7/site-packages/portray/render.py", line 169, in _mkdocs_config
f"Aborted with {len(errors)} Configuration Errors!"
mkdocs.exceptions.ConfigurationError: Aborted with 1 Configuration Errors!```
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Configuration - MkDocs
A list of plugins (with optional configuration settings) to use when building the site. See the Plugins documentation for full details. If the...
Read more >Mkdocs - The Blue Book - GitHub Pages
MkDocs is a fast, simple and downright gorgeous static site generator that's geared towards building project documentation. Documentation source files are ...
Read more >user_config/pyproject.toml · master - GitLab du LIRIS
Template to easily setup and managed mkdocs documentation in folder to have homogenous documentation. This repo hosts mkdocs configuration ...
Read more >Commands | master | Documentation | Poetry - Python ...
--no-plugins : Disables plugins. ... The install command reads the pyproject.toml file from the current project, ... poetry remove mkdocs --group docs.
Read more >mkdocs-simple-plugin Changelog - PyUp.io
Switch to pyproject.toml and Hatch build (422) athackst. Dependency Updates <details> <summary>5 changes</summary> * Bump mkdocs-material from 8.5.9 to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@KyleKing I just ran into the same issue. It turns out that TOML doesn’t usually allow multiple separate types and you can’t have
and also
which is why the poetry check fails. Merging them as you did would work, but portray does not (yet?) handle markdown_extensions with empty properties.
However, portray does have the extra_markdown_extensions property, which I assume is to avoid the multiple type error. I did the following, which passes the poetry check and works for portray!
(there’s some extra stuff in there, just pay attention to the use of
tool.portray.mkdocs.markdown_extensions
andtool.portray.extra_markdown_extensions
)Hi @JesseWebDotCom,
I implemented custom slate/light styles in the dcm2bids repo based on whether the person has light vs dark OS. Feel free to peek into the repo.
In short the pyproject.toml looks like this: