mikitex70 / plantuml-markdown

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

Cannot get !include working! #55

Closed thepeej-pwhite6 closed 2 years ago

thepeej-pwhite6 commented 3 years ago

I am attempting to get an include working, and failing.

In my mkdocs.yml I have the following:

markdown_extensions:
  - plantuml_markdown:
      server: "http://www.plantuml.com/plantuml"
      base_dir: "."

In my MwkrDown file I have the follwing:

```plantuml
@startuml
!include subFolder/myFile.plantUml!0
@enduml

I get the following error when running `mkdocs serve`:

[E 210625 12:42:58 ioloop:907] Exception in callback <bound method LiveReloadHandler.poll_tasks of <class 'livereload.handlers.LiveReloadHandler'>> Traceback (most recent call last): File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\tornado\ioloop.py", line 905, in _run return self.callback() File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\livereload\handlers.py", line 69, in poll_tasks filepath, delay = cls.watcher.examine() File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\livereload\watcher.py", line 119, in examine func() File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\mkdocs\commands\serve.py", line 114, in builder build(config, live_server=live_server, dirty=dirty) File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\mkdocs\commands\build.py", line 274, in build _populate_page(file.page, config, files, dirty) File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\mkdocs\commands\build.py", line 177, in _populate_page page.render(config, files) File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\mkdocs\structure\pages.py", line 184, in render self.content = md.convert(self.markdown) File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\markdown\core.py", line 261, in convert self.lines = prep.run(self.lines) File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\plantuml_markdown.py", line 124, in run text1, idx1 = self._replace_block(text[idx:]) File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\plantuml_markdown.py", line 181, in _replace_block diagram = self._render_diagram(code, requested_format) File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\plantuml_markdown.py", line 251, in _render_diagram diagram = self._render_remote_uml_image(code, requested_format) File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\plantuml_markdown.py", line 280, in _render_remote_uml_image return PlantUML("%s/%s/" % (self.config['server'], img_format)).processes(plantuml_code) File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\plantuml.py", line 173, in processes raise PlantUMLHTTPError(response, content) File "c:\users{myArea}\appdata\local\programs\python\python39\lib\site-packages\plantuml.py", line 56, in init if not self.message: AttributeError: 'PlantUMLHTTPError' object has no attribute 'message'



I've searched around other closed issues on similar topics.  I've also done a more general search using Google.  I've not been able to resolve. **Please help!**
mikitex70 commented 2 years ago

Hi @thepeej-pwhite6 , sorry for the long delay. I've checked your configuration and there are some issues to fix:

  1. the include instruction ends with !'0: remove it, it is not needed, this is not markdown, it's plantuml
  2. in he plugin configuration you set base_dir: ".": are you sure to known what is the current directory for the mkdocs/markdown process? Almost certainly is under the c:\users\{myArea}\appdata\local\programs\python\python39. To be sure set it to an absolute path
  3. you set server: "http://www.plantuml.com/plantuml": the include instruction is executed by the www.plantuml.com site, so how do you think could it load a file from your local filesystem? Remove it and install plantuml locally to use includes, or put your includes in a publicly accessible web server.
thepeej-pwhite6 commented 2 years ago

Thanks for the feedback - really appreciated. Your points have helped me to understand the fuller context of the includes. I will go back and rethink my approach.