figureAltCaption
figureAltCaption copied to clipboard
Not working with python-markdown 3 and above
This does not seem to be working anymore, at least not on mkdocs, I don't have another way to test.
ERROR - Config value: 'markdown_extensions'. Error: Failed loading extension "figureAltCaption".
I forked it and checked it, and noticed that there were some imports that weren't valid anymore and removed them, but even then, it kept failing, but now with a different error.
ERROR - Config value: 'markdown_extensions'. Error: configs
I have no experience with markdown extensions, so I really don't know how to test.
Thanks for reporting the issue. I tried with the command line version of python markdown and it seems to work well for me: cat somemarkdown.md | python3 -m markdown -x figureAltCaption
My version is 2.6.9 which is what is shown when I execute python3 -m markdown --version
Or do you use the very recent 3.0 version of the markdown extensions? (I have not tried with that one yet)
I think that's definitely the problem, they introduced many breaking changes in 3.0 :(
I tried manually downgraded to Markdown 2.6.*, but then it breaks the requirements because of pymdown-extensions 5.0`.
I'm pretty sure doing those downgrades will make it work again, I will test later.
Have you considered adding this to pypi? It would be a great addition there. It would require implementing a versioning system tho.
I think that's definitely the problem, they introduced many breaking changes in 3.0
OK, that seems probable. I will set up an environment and test with 3.0.
Have you considered adding this to pypi? Good idea. I created #5 (Add to pypi)
How can I help? We really need this functionality!
After testing with markdown 3.0.1 in python 3.7.1 I get the following Traceback:
>>> import figureAltCaption
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "miniconda3/envs/mkdocs-new/lib/python3.7/site-packages/figureAltCaption.py", line 33, in <module>
from markdown.inlinepatterns import IMAGE_LINK_RE, IMAGE_REFERENCE_RE, NOBRACKET, BRK
ImportError: cannot import name 'NOBRACKET' from 'markdown.inlinepatterns' (miniconda3/envs/mkdocs-new/lib/python3.7/site-packages/markdown/inlinepatterns.py)
>>>
Seems that at least NOBRACKET is gone from inlinepatterns. From the code in figureAltCaption I gather that this is actually not used (also BRK is not used). Could we just remove that from the import-line?
I think it works fine with the mods (also changed the makeExtension-part)!
Newbie-mode: how can I submit the changes with a pull request?
I think this is the documentation page which explains pull requesting. It assumes that you have forked the repo.
Hi. I wanted to let you know that I've updated this plugin to work with Python Markdown 3, using Inline Patterns instead of Block Processors. See the code here. I have only implemented the support for image links, not image references (which I why I don't directly create a PR), but this should make it easier to adapt for the latter I hope.
We processed hundreds of article with the extension on Python 3.6 and it was running perfectly. Only recently we move our code (with an old version of the extension) onto Python 3.8 and that fails on this traceback - ImportError: cannot import name 'NOBRACKET' from 'markdown.inlinepatterns'. Since then we updated on your latest commit 2c867c0 and it seems to work fine. Appreciated thanks your efforts.