mikitex70 / plantuml-markdown

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

svg_inline bug #53

Closed ldeluigi closed 3 years ago

ldeluigi commented 3 years ago

I'm using svg_inline with this markdown file:

# kek
```plantuml
  Goofy <-- MickeyMouse: responds
  Goofy ->  MickeyMouse: calls

When I call `markdown_py -x plantuml_markdown -c /pymd_config.yml file > dest` with this config:
```yml
plantuml_markdown:
  cachedir: /tmp                            # set a non-empty value to enable caching
  base_dir: /wiki                           # where to search for diagrams to include
  format: svg_inline                               # default diagram image format
  classes: UML                              # default diagram classes
  title: UML diagram                        # default title (tooltip) for diagram images
  alt: UML diagram image                    # default `alt` attribute for diagram images
  priority: 23                              # plugin priority; the higher, the sooner will be applied (default 23)

This happens:

Traceback (most recent call last):
  File "/usr/local/bin/markdown_py", line 8, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.9/site-packages/markdown/__main__.py", line 145, in run
    markdown.markdownFromFile(**options)
  File "/usr/local/lib/python3.9/site-packages/markdown/core.py", line 405, in markdownFromFile
    md.convertFile(kwargs.get('input', None),
  File "/usr/local/lib/python3.9/site-packages/markdown/core.py", line 334, in convertFile
    html = self.convert(text)
  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 124, in run
    text1, idx1 = self._replace_block(text[idx:])
  File "/usr/local/lib/python3.9/site-packages/plantuml_markdown.py", line 194, in _replace_block
    img = etree.fromstring(data.encode('UTF-8'))
  File "/usr/local/lib/python3.9/xml/etree/ElementTree.py", line 1347, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: syntax error: line 1, column 0
ldeluigi commented 3 years ago

Found the problem: my /usr/local/bin/plantuml had a debug echo that ruined the standard output of the script. After removing it now it works again