Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of Admonition #82

Open
Kanaduchi opened this issue Apr 7, 2020 · 5 comments
Open

Add support of Admonition #82

Kanaduchi opened this issue Apr 7, 2020 · 5 comments

Comments

@Kanaduchi
Copy link
Contributor

Is it possible to add support of https://python-markdown.github.io/extensions/admonition/ extension?

Currently when I try to export such pages I got an error:

Traceback (most recent call last):
  File "/home/docs/.pyenv/versions/3.7.3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/docs/.pyenv/versions/3.7.3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/docs/checkouts/readthedocs.org/user_builds/mqb/envs/newstructure/lib/python3.7/site-packages/mkdocs/__main__.py", line 202, in <module>
    cli()
  File "/home/docs/checkouts/readthedocs.org/user_builds/mqb/envs/newstructure/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/docs/checkouts/readthedocs.org/user_builds/mqb/envs/newstructure/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/docs/checkouts/readthedocs.org/user_builds/mqb/envs/newstructure/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/docs/checkouts/readthedocs.org/user_builds/mqb/envs/newstructure/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/docs/checkouts/readthedocs.org/user_builds/mqb/envs/newstructure/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/docs/checkouts/readthedocs.org/user_builds/mqb/envs/newstructure/lib/python3.7/site-packages/mkdocs/__main__.py", line 163, in build_command
    ), dirty=not clean)
  File "/home/docs/checkouts/readthedocs.org/user_builds/mqb/envs/newstructure/lib/python3.7/site-packages/mkdocs/commands/build.py", line 298, in build
    config['plugins'].run_event('post_build', config)
  File "/home/docs/checkouts/readthedocs.org/user_builds/mqb/envs/newstructure/lib/python3.7/site-packages/mkdocs/plugins.py", line 94, in run_event
    result = method(item, **kwargs)
  File "/home/docs/checkouts/readthedocs.org/user_builds/mqb/envs/newstructure/lib/python3.7/site-packages/mkdocs_pdf_export_plugin/plugin.py", line 120, in on_post_build
    self.renderer.write_combined_pdf(abs_pdf_path)
  File "/home/docs/checkouts/readthedocs.org/user_builds/mqb/envs/newstructure/lib/python3.7/site-packages/mkdocs_pdf_export_plugin/renderer.py", line 50, in write_combined_pdf
    render = self.render_doc(p[0], p[1], p[2])
TypeError: 'NoneType' object is not subscriptable
@rocinante333
Copy link

I am able to export without issue; however, the icons used with Admonition are converted to soild color squares.

image

@theanurin
Copy link

I am able to export without issue; however, the icons used with Admonition are converted to soild color squares.

image

I have same experience, but in my case generated PDF has empty page before current page. May be related to #89

@estan
Copy link

estan commented Mar 27, 2022

@rocinante333 @theanurin I found that admonitions used to look correct (including icon, and with correct border look) in mkdocs-material 4.6.3 but broke with mkdocs-material 5.0.0 (first bad commit is b345a0b65) and filed this mkdocs-material issue about it: squidfunk/mkdocs-material#3771

I'm not sure if the solution is some change in mkdocs-material or if mkdocs-pdf-export-plugin or weasyprint needs to do something to "catch up" to handle the changes in mkdocs-material, but let's see what mkdocs-material maintainer says.

@estan
Copy link

estan commented Mar 27, 2022

So mkdocs-material author closed the issue saying they don't officially support mkdocs-pdf-export-plugin.

@zhaoterryy Perhaps my investigation in squidfunk/mkdocs-material#3771 can still be of use. It shows that mkdocs-material b345a0b65 Prototyped material icon SVG integration was the first revision of mkdocs-material where mkdocs-pdf-export-plugin started having problem with the admonitions (render them incorrectly).

@estan
Copy link

estan commented Mar 27, 2022

Turns out the missing icon is due to lack of support for image-mask in WeasyPrint (Kozea/WeasyPrint#1458). mkdocs-materials is using this since version 5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants