mikitex70 / plantuml-markdown

PlantUML plugin for Python-Markdown
BSD 2-Clause "Simplified" License
192 stars 55 forks source link

optional support for image maps #74

Closed anb0s closed 1 year ago

anb0s commented 1 year ago

It would be good to have option to disable "Added support for image maps".

We are using the Kroki server and it has no support for maps (yet) and we facing broken diagrams with message WARNING in "uml" directive: remote server has returned error 400 in mkdocs builds. The workaround is to set plantuml-markdown = "3.4.3".

Trying to understand the code and contribute, but will take some time...

anb0s commented 1 year ago

migrated to new 3.7.0 and do negative test with maps by intention, now it shows the error message from kroki 👍

WARNING in "uml" directive: remote server has returned error 400 on GET: Error 400: Unsupported output format: map. Must be one of plantuml for png, svg, jpeg, base64, txt or utxt.
anb0s commented 1 year ago

ok the whole trace shows that we have exception now, because using Kroki but configured PlatntUML:

WARNING in "uml" directive: remote server has returned error 400 on GET: Error 400: Unsupported output format: map. Must be one of plantuml for png, svg, jpeg, base64, txt or utxt.
ERROR    -  Error reading page 'Appendix/EditorialHints/Draft/Support/Layout/Layout.md': 'NoneType' object has no attribute 'decode'
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 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line [140](https://code.siemens.com/oie-jupiter/documentation/arc-doc/-/jobs/91074196#L140)4, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/__main__.py", line 192, 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 292, in build
    _populate_page(file.page, config, files, dirty)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 174, in _populate_page
    page.render(config, files)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/structure/pages.py", line 175, in render
    self.content = md.convert(self.markdown)
  File "/usr/local/lib/python3.9/site-packages/markdown/core.py", line 261, in convert
    self.lines = prep.run(self.lines)
  File "/usr/local/lib/python3.9/site-packages/plantuml_markdown.py", line 131, in run
    text1, idx1 = self._replace_block(text[idx:])
  File "/usr/local/lib/python3.9/site-packages/plantuml_markdown.py", line 231, in _replace_block
    map_data = map_data.decode("utf-8")
AttributeError: 'NoneType' object has no attribute 'decode'
anb0s commented 1 year ago

set

  plantuml_markdown:
    image_maps: false

resolves the exception

anb0s commented 1 year ago

Thank You!

mikitex70 commented 1 year ago

Yes, image maps must be explicitly disabled with Kroki, as per request and README, so when they implement image maps no code changes are required (I hope),