MikhailKravets / mkdocs_puml

Inline PlantUML diagrams in your MkDocs documentation
MIT License
26 stars 5 forks source link

Version 1.2.1 breaks mkdocs generation #28

Closed fstehle closed 1 year ago

fstehle commented 1 year ago

Describe the bug The new version 1.2.1 breaks mkdocs generation.

To Reproduce Steps to reproduce the behavior:

$ pip install mkdocs-material mkdocs-awesome-pages-plugin mkdocs_puml mkdocs-macros-plugin

...
Installing collected packages: watchdog, urllib3, termcolor, six, regex, pyyaml, pygments, packaging, natsort, mkdocs-material-extensions, mergedeep, MarkupSafe, markdown, idna, colorama, click, charset-normalizer, certifi, bracex, wcmatch, requests, pyyaml-env-tag, python-dateutil, pymdown-extensions, jinja2, ghp-import, mkdocs, mkdocs_puml, mkdocs-material, mkdocs-macros-plugin, mkdocs-awesome-pages-plugin
Successfully installed MarkupSafe-2.1.3 bracex-2.3.post1 certifi-2023.5.7 charset-normalizer-3.1.0 click-8.1.3 colorama-0.4.6 ghp-import-2.1.0 idna-3.4 jinja2-3.1.2 markdown-3.3.7 mergedeep-1.3.4 mkdocs-1.4.3 mkdocs-awesome-pages-plugin-2.9.1 mkdocs-macros-plugin-1.0.1 mkdocs-material-9.1.17 mkdocs-material-extensions-1.1.1 mkdocs_puml-1.2.1 natsort-8.4.0 packaging-23.1 pygments-2.15.1 pymdown-extensions-10.0.1 python-dateutil-2.8.2 pyyaml-6.0 pyyaml-env-tag-0.1 regex-2023.6.3 requests-2.31.0 six-1.16.0 termcolor-2.3.0 urllib3-2.0.3 watchdog-3.0.0 wcmatch-8.4.1

$ mkdocs build -s
INFO     -  [macros] - Macros arguments: {'module_name': 'main', 'modules': [], 'render_by_default': True, 'include_dir': '', 'include_yaml': [], 'j2_block_start_string': '', 'j2_block_end_string': '', 'j2_variable_start_string': '', 'j2_variable_end_string': '', 'on_undefined': 'keep', 'on_error_fail': False, 'verbose': False}
INFO     -  [macros] - Found local Python module 'main' in: /home/runner/work/my-project/my-project/mkdocs
INFO     -  [macros] - Found external Python module 'main' in: /home/runner/work/my-project/my-project/mkdocs
INFO     -  [macros] - Extra filters (module): ['pretty']
INFO     -  Cleaning site directory
INFO     -  Building documentation to directory: /home/runner/work/my-project/my-project/mkdocs/site
ERROR    -  Error building page '.../my-doc.md': 'Page' object has no attribute 'html'
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.4/x64/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/mkdocs/__main__.py", line 277, in gh_deploy_command
    build.build(cfg, dirty=not clean)
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/mkdocs/commands/build.py", line 329, in build
    _build_page(file.page, config, doc_files, nav, env, dirty)
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/mkdocs/commands/build.py", line 234, in _build_page
    output = config.plugins.run_event('post_page', output, page=page, config=config)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/mkdocs/plugins.py", line 520, in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/mkdocs_puml/plugin.py", line 130, in on_post_page
    page.html = self._replace(v, page.html)
                                 ^^^^^^^^^
AttributeError: 'Page' object has no attribute 'html'
Error: Process completed with exit code 1.

Expected behavior mkdocs files should be successfully built

MikhailKravets commented 1 year ago

@fstehle, thanks for raising an issue. Please share the version of python and mkdocs you use?

UPD This is an issue with mkdocs >=1.4. I'm already working on hotfix.

fstehle commented 1 year ago

We use the following versions:

CPython 3.11.4
mkdocs 1.4.3
MikhailKravets commented 1 year ago

@fstehle, please upgrade to the newest 1.2.2 version. It is now compatible with mkdocs ~= 1.4