mikitex70 / plantuml-markdown

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

Extension broken with Markdown 3 #15

Closed ntarocco closed 5 years ago

ntarocco commented 5 years ago

I am using the extension but with the release of Markdown 3.0.0 and 3.0.1 the extension is broken. I didn't have time to look into the code. For now, I have pinned to Markdown<3 and everything works.

mikitex70 commented 5 years ago

I've tested v1.2.5 of the plugin with Python 3.5.5 and Markdown 3.0.1 and seems to work without problems. Can you post a log trace and a simple markdown test to be able to reproduce your error? And, what version of Python are you using?

ntarocco commented 5 years ago

I am sorry, the problem apparently comes from mkdocs and not from this package. Sorry for the noise, I close the issue.

ntarocco commented 5 years ago

Actually, I am doing further tests, the problem happens loading plantuml.py (I am using mkdocs).

Traceback (most recent call last):

  File "....../.virtualenvs/drdoc/bin/mkdocs", line 11, in <module>
    sys.exit(cli())
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/mkdocs/__main__.py", line 156, in build_command
    ), dirty=not clean)
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/mkdocs/commands/build.py", line 282, in build
    build_pages(config, dirty=dirty)
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/mkdocs/commands/build.py", line 242, in build_pages
    _build_page(page, config, site_navigation, env)
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/mkdocs/commands/build.py", line 137, in _build_page
    page.render(config, site_navigation)
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/mkdocs/nav.py", line 293, in render
    extension_configs=config['mdx_configs'] or {}
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/markdown/core.py", line 100, in __init__
    configs=kwargs.get('extension_configs', {}))
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/markdown/core.py", line 126, in registerExtensions
    ext = self.build_extension(ext, configs.get(ext, {}))
  File "....../.virtualenvs/drdoc/lib/python2.7/site-packages/markdown/core.py", line 166, in build_extension
    module = importlib.import_module(ext_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: Failed loading extension "plantuml".

Environment:

While, downgrading Markdown, everything works. Does it help?

mikitex70 commented 5 years ago

I'm unable reproduce your problem. My test steps:

# Create a test environment
mkdir /tmp/test
cd /tmp/test
python2 -m virtualenv env
. env/bin/activate
# installing required packages
pip install mkdocs==1.0.4 markdown==3.0.1 plantuml-markdown==1.2.5 pymdown-extensions==5.0
mkdocs new testsite
cd testsite
# Activating plantuml markdown extension
cat >>mkdocs.yml <<EOF
markdown_extensions:
    - plantuml
EOF
# Adding a simple diagram to index page
cat >>docs/index.md <<'EOF'

```plantuml
a -> b

EOF

Starting server

mkdocs serve


and the diagram was correctly rendered.
I'm missing something?
ntarocco commented 5 years ago

Thank you @mikitex70 for the example, it actually works. So, I was not using directly the extension via pip install, but using the second method explained in your readme (old tests) that was copying the file. Well it should be the same, but it stopped working with the release of Markdown... I don't have a clear explanation, sorry. Now I switched to pip install everything, and it works perfectly.

Thank you for trying it out!