-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open
Description
Context
No response
Bug description
I am experiencing an error with the following example configs:
theme:
name: material
font:
text: Helvetica Neue
plugins:
material/social:
theme:
name: material
font:
text: Helvetica Neue
plugins:
material/social:
cards_layout_options:
font_family: Roboto
The following config works though:
theme:
name: material
font:
text: Helvetica Neue
plugins:
material/social:
cards_font: Roboto
$> poetry run mkdocs serve
Configuration file exists at /Users/pere/Library/Preferences/pypoetry, reusing this directory.
Consider moving TOML configuration files to /Users/pere/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
WARNING - Config value 'plugins': Plugin 'material/social' option 'cards_font': Deprecated, use 'cards_layout_options.font_family'
INFO - Building documentation...
[...]
With the first and second example configs, the error is:
Configuration file exists at /Users/pere/Library/Preferences/pypoetry, reusing this directory.
Consider moving TOML configuration files to /Users/pere/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
INFO - Building documentation...
Traceback (most recent call last):
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/bin/mkdocs", line 8, in <module>
sys.exit(cli())
^^^^^
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/mkdocs/__main__.py", line 234, in serve_command
serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/mkdocs/commands/serve.py", line 83, in serve
builder(config)
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/mkdocs/commands/serve.py", line 76, in builder
build(config, live_server=live_server, dirty=dirty)
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/mkdocs/commands/build.py", line 270, in build
config = config.plugins.run_event('config', config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/mkdocs/plugins.py", line 520, in run_event
result = method(item, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 157, in on_config
self.font = self._load_font(config)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 469, in _load_font
self._load_font_from_google(name)
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/lib/python3.11/site-packages/material/plugins/social/plugin.py", line 492, in _load_font_from_google
zip = ZipFile(tmp)
^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/zipfile.py", line 1302, in __init__
self._RealGetContents()
File "/opt/homebrew/Cellar/python@3.11/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/zipfile.py", line 1369, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
I tried adding a debug statement in material/plugins/social/plugin.py:
# If none found, fetch from Google and try again
if len(font) == 0:
print ("Fetching font %s from Google" % name)
self._load_font_from_google(name)
And it seems it is trying to download the custom font set in theme.font.text from Google Fonts:
$ poetry run mkdocs serve --config-file mkdocs-public.yml
Configuration file exists at /Users/pere/Library/Preferences/pypoetry, reusing this directory.
Consider moving TOML configuration files to /Users/pere/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
INFO - Building documentation...
Fetching font <CUSTOM_FONT_NAME> from Google
Traceback (most recent call last):
File "/Users/pere/Library/Caches/pypoetry/virtualenvs/docs-theme-demo-H653cWUy-py3.11/bin/mkdocs", line 8, in <module>
sys.exit(cli())
^^^^^
[...]
Related links
Reproduction
Steps to reproduce
Run mkdocs serve with the provided examples
Browser
No response
Before submitting
- I have read and followed the bug reporting guidelines.
- I have attached links to the documentation, and possibly related issues and discussions.
- I assure that I have removed all customizations before submitting this bug report.
- I have attached a .zip file with a minimal reproduction.
Metadata
Metadata
Assignees
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open