mikitex70 / plantuml-markdown

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

Can't make plantuml-markdown work on Windows #63

Closed bcoueraud87 closed 2 years ago

bcoueraud87 commented 2 years ago

I am trying to run the command markdown_py -x plantuml_markdown FMI.md > out.html on Windows, where FMI.md is a markdown file with a PlantUML diagram inside (attached to this issue). The command works fine on Linux.

Note that:

FMI.md

mikitex70 commented 2 years ago

Hi @bcoueraud87, what is the behavior? Is it generating an error, or it simply ignores the diagram? What version of Python and markdown are you using? I need some info to be able to reproduce your issue.

bcoueraud87 commented 2 years ago

Hi @mikitex70, on Linux I get the html page with the diagram, whereas on Windows I get an error. Here is the stacktrace I get after running the command markdown_py -x plantuml_markdown FMI.md > out.html:

Traceback (most recent call last):
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\coue_be\AppData\Roaming\Python\Python36\Scripts\markdown_py.exe\__main__.py", line 9, in <module>
  File "C:\Users\coue_be\AppData\Roaming\Python\Python36\site-packages\markdown\__main__.py", line 145, in run
    markdown.markdownFromFile(**options)
  File "C:\Users\coue_be\AppData\Roaming\Python\Python36\site-packages\markdown\core.py", line 407, in markdownFromFile
    kwargs.get('encoding', None))
  File "C:\Users\coue_be\AppData\Roaming\Python\Python36\site-packages\markdown\core.py", line 334, in convertFile
    html = self.convert(text)
  File "C:\Users\coue_be\AppData\Roaming\Python\Python36\site-packages\markdown\core.py", line 261, in convert
    self.lines = prep.run(self.lines)
  File "C:\Users\coue_be\AppData\Roaming\Python\Python36\site-packages\plantuml_markdown.py", line 126, in run
    text1, idx1 = self._replace_block(text[idx:])
  File "C:\Users\coue_be\AppData\Roaming\Python\Python36\site-packages\plantuml_markdown.py", line 222, in _replace_block
    map = etree.fromstring(map_data)
  File "c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\xml\etree\ElementTree.py", line 1315, in XML
    return parser.close()
xml.etree.ElementTree.ParseError: no element found: line 2, column 0

My version of Python is 3.6, my version of markdown is 3.3.7 and my version of plantuml-markdown is 3.5.2.

mikitex70 commented 2 years ago

Hi @bcoueraud87, the issue should now be fixed, install the latest release There was a bug in the image map detection caused by the different end-of-line terminator between Linux and Windows. Thanks for reporting it.

bcoueraud87 commented 2 years ago

Hi @mikitex70, it works, thank you very much!