MikhailKravets / mkdocs_puml

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

Fails to build docs #15

Closed gamingdiamond982 closed 1 year ago

gamingdiamond982 commented 1 year ago

Describe the bug when I run mkdocs serve I get an xml.parsers.expat.ExpatError and the program crashes

To Reproduce Steps to reproduce the behavior:

  1. Install the program from pip
  2. add any puml to a markdown page
  3. run mkdocs serve I get the following output:
    [aj@puter-box computer-science-notes]$ python3 -m mkdocs serve
    INFO     -  Building documentation...
    INFO     -  Cleaning site directory
    Traceback (most recent call last):
    File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
    File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
    File "/home/aj/.local/lib/python3.10/site-packages/mkdocs/__main__.py", line 236, in <module>
    cli()
    File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
    File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
    File "/home/aj/.local/lib/python3.10/site-packages/mkdocs/__main__.py", line 181, in serve_command
    serve.serve(dev_addr=dev_addr, livereload=livereload, watch=watch, **kwargs)
    File "/home/aj/.local/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 63, in serve
    config = builder()
    File "/home/aj/.local/lib/python3.10/site-packages/mkdocs/commands/serve.py", line 58, in builder
    build(config, live_server=live_server, dirty=dirty)
    File "/home/aj/.local/lib/python3.10/site-packages/mkdocs/commands/build.py", line 295, in build
    env = config['plugins'].run_event(
    File "/home/aj/.local/lib/python3.10/site-packages/mkdocs/plugins.py", line 102, in run_event
    result = method(item, **kwargs)
    File "/home/aj/.local/lib/python3.10/site-packages/mkdocs_puml/plugins.py", line 104, in on_env
    resp = self.puml.translate(self.diagrams.values())
    File "/home/aj/.local/lib/python3.10/site-packages/mkdocs_puml/puml.py", line 55, in translate
    return [self.postprocess(v) for v in svg_images]
    File "/home/aj/.local/lib/python3.10/site-packages/mkdocs_puml/puml.py", line 55, in <listcomp>
    return [self.postprocess(v) for v in svg_images]
    File "/home/aj/.local/lib/python3.10/site-packages/mkdocs_puml/puml.py", line 85, in postprocess
    svg = self._convert_to_dom(diagram_content)
    File "/home/aj/.local/lib/python3.10/site-packages/mkdocs_puml/puml.py", line 109, in _convert_to_dom
    dom = parseString(content)  # nosec
    File "/usr/lib/python3.10/xml/dom/minidom.py", line 1998, in parseString
    return expatbuilder.parseString(string)
    File "/usr/lib/python3.10/xml/dom/expatbuilder.py", line 925, in parseString
    return builder.parseString(string)
    File "/usr/lib/python3.10/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
    xml.parsers.expat.ExpatError: not well-formed (invalid token): line 3, column 439

Desktop (please complete the following information):

Additional Context: my mkdocs.yml is as follows:

 site_name: "Computer Science Notes"
 site_url:  "https://redacted.github.io/computer-science-notes/"

 plugins:
   - plantuml:
       puml_url: https://www.plantuml.com/puml/
       num_worker: 8

and the only uml in the repo is this:

\```puml
@startuml
A -> B : start handshake
B -> A : close handshake  
@enduml
\```
gamingdiamond982 commented 1 year ago

I'm stupid, the puml_url is wrong.