Hi All,
I'm trying to use python-markdown with only limited success. The code below runs fine and produces a html string
import markdown
import inspect
import os
my_text_string = """This is a textstring
spanning multiple lines
## with h2 title
A list
* one [^footnote]
* two
* three
A definition
: with description
[^footnote] this is the content of the note
"""
# pad = os.path.dirname(inspect.getfile(md.core))
# print(pad)
md = markdown.Markdown()
html = md.convert(my_text_string)
print(html)
However as soon as I like to use the standard markdown.extensions.extra, I get an error message: "no module named 'fenced_code' "
This is the first extension listed in the extensions list that is part of the module "extra.py".
With following trace-back:
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/../Pythonista3/Documents/pythonista/markdownPlayGround.py", line 27, in <module>
md = markdown.Markdown(extensions=['markdown.extensions.extra'])
File "/private/var/mobile/Containers/Shared/AppGroup/../Pythonista3/Documents/site-packages-3/markdown/core.py", line 97, in __init__
configs=kwargs.get('extension_configs', {}))
File "/private/var/mobile/Containers/Shared/AppGroup/../Pythonista3/Documents/site-packages-3/markdown/core.py", line 125, in registerExtensions
ext._extendMarkdown(self)
File "/private/var/mobile/Containers/Shared/AppGroup/../Pythonista3/Documents/site-packages-3/markdown/extensions/__init__.py", line 77, in _extendMarkdown
self.extendMarkdown(md)
File "/private/var/mobile/Containers/Shared/AppGroup/../Pythonista3/Documents/site-packages-3/markdown/extensions/extra.py", line 54, in extendMarkdown
md.registerExtensions(extensions, self.config)
File "/private/var/mobile/Containers/Shared/AppGroup/../Pythonista3/Documents/site-packages-3/markdown/core.py", line 123, in registerExtensions
ext = self.build_extension(ext, configs.get(ext, {}))
File "/private/var/mobile/Containers/Shared/AppGroup/../Pythonista3/Documents/site-packages-3/markdown/core.py", line 163, in build_extension
module = importlib.import_module(ext_name)
File "/var/containers/Bundle/Application/../Pythonista3.app/Frameworks/Py3Kit.framework/pylib/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'fenced_code'
I have the feeling that this has something to do with the "path" of the module not being passed properly to init.py, but have no clue how to fix this
As you can see markdown sits in site-packages-3 and the "extension" subdirectory is found by the markdown "register extensions" method. So markdown itself seems to work as it should, but then the deeper calls into python(ista) seem to loose track of where to look...