mkdocs-with-pdf
mkdocs-with-pdf copied to clipboard
Cannot build PDFs when using latest version of beautifulsoup4 >= 4.10
Hi,
Environment: Python 3.9, Alpine 3.14 MkDocs version: 1.1.2 Plugin version: 0.9.3
When building with mkdocs build
:
INFO - [macros] - Macros arguments: {'module_name': 'main', 'modules': [], 'include_dir': 'includes', 'include_yaml': [], 'j2_block_start_string': '', 'j2_block_end_string': '', 'j2_variable_start_string': '', 'j2_variable_end_string': '', 'verbose': False}
INFO - [macros] - Extra variables (config file): ['social', 'doc_version', 'caddy_version']
INFO - [macros] - Extra filters (module): ['pretty']
INFO - [macros] - Includes directory: includes
INFO - Cleaning site directory
INFO - Building documentation to directory: /docs/dist
INFO - Number headings up to level 3.
INFO - | (exclude 'changelog/:changelog')
INFO - Generate a table of contents up to heading level 2.
INFO - | (exclude 'changelog/:changelog')
INFO - Generate a cover page with "default_cover.html.j2".
INFO - Converting <img> alignment(workaround).
Traceback (most recent call last):
File "/usr/local/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1062, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/mkdocs/__main__.py", line 152, in build_command
build.build(config.load_config(**kwargs), dirty=not clean)
File "/usr/local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 295, in build
config['plugins'].run_event('post_build', config=config)
File "/usr/local/lib/python3.9/site-packages/mkdocs/plugins.py", line 96, in run_event
result = method(**kwargs)
html_string = self._render_js(soup)
File "/usr/local/lib/python3.9/site-packages/mkdocs_with_pdf/generator.py", line 381, in _render_js
tag.text = self._mixed_script
AttributeError: can't set attribute
It seems related by changes on tag introduced in beautifulsoup4 v4.10+. Not yet sure, anyway, a workaround is to pip install first beautifulsoup4==4.9.3
then install this plugin to make it works again.
It's work for me, Thanks a lot.