Closed JulioV closed 3 years ago
This is because mike uses safe_load
to load YAML files, so as to prevent people from doing malicious things with them. That's probably not very useful though, since it seems MkDocs doesn't use safe_load
. If you replace safe_load
with load
here, does it work?
https://github.com/jimporter/mike/blob/3ce1a8c92c296bf9a1f0c5419def85658eb3a2f5/mike/mkdocs.py#L9
It does work!
Awesome! I'll commit a change with that fix and publish a quick hotfix to PyPI shortly...
Just so you know, you get the following warning:
The default 'Loader' for 'load(stream)' without further arguments can be unsafe.
Use 'load(stream, Loader=ruamel.yaml.Loader)' explicitly if that is OK.
Alternatively include the following in your code:
import warnings
warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning)
In most other cases you should consider using 'safe_load(stream)'
config = yaml.load(f)
Ah, right. I forgot about that...
This should all be working correctly in 64807ea58db41d7002c911cab2b665ac91c8e1d8 and published on PyPI at https://pypi.org/project/mike/0.5.5/
Thanks for catching this (and the warning message)!
I found the following error while trying to deploy a site with
pymdownx.emoji
extension enabled, python 3.7.3 and mike 0.5.3 on MacOS 10.15.7:The minimal reproducible example is a site with the following
mkdocs.yaml