Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[notebook] Fails to render some content when markdown toc extension is enabled #4

Open
mirekdlugosz opened this issue Feb 7, 2021 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@mirekdlugosz
Copy link
Collaborator

On my test website, following pelican configuration:

MARKDOWN = {
    'extension_configs': {
        'markdown.extensions.toc': {'anchorlink': True},
    },
    'output_format': 'html',
}

LIQUID_TAGS = ["notebook"]

causes multiple (but not all) pages to fail with following error message:

ERROR: Could not process pages/site-policy.md
  | append() argument must be xml.etree.ElementTree.Element, not Element
  |___
  | Traceback (most recent call last):
  |   File "/tmp/venv-website/lib/python3.9/site-packages/pelican/generators.py", line 721, in generate_context
  |     page = self.readers.read_file(
  |   File "/tmp/venv-website/lib/python3.9/site-packages/pelican/readers.py", line 573, in read_file
  |     content, reader_metadata = reader.read(path)
  |   File "/tmp/venv-website/lib/python3.9/site-packages/pelican/readers.py", line 337, in read
  |     content = self._md.convert(text)
  |   File "/tmp/venv-website/lib/python3.9/site-packages/markdown/core.py", line 268, in convert
  |     newRoot = treeprocessor.run(root)
  |   File "/tmp/venv-website/lib/python3.9/site-packages/markdown/extensions/toc.py", line 295, in run
  |     self.add_anchor(el, el.attrib["id"])
  |   File "/tmp/venv-website/lib/python3.9/site-packages/markdown/extensions/toc.py", line 218, in add_anchor
  |     c.append(anchor)
  | TypeError: append() argument must be xml.etree.ElementTree.Element, not Element

Not using toc markdown extension or not using notebook liquid tag makes all pages render again, which means that these two sometimes interact in unexpected way.

Root cause should be identified and issue must be fixed, so users are free to use both toc extension and notebook tag on their blogs.

@mirekdlugosz mirekdlugosz added bug Something isn't working help wanted Extra attention is needed labels Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant