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

pelican markdown : No module named 'markdown.extensions.headerid' #2968

Closed
2 tasks done
phwuil opened this issue Jan 6, 2022 · 4 comments
Closed
2 tasks done

pelican markdown : No module named 'markdown.extensions.headerid' #2968

phwuil opened this issue Jan 6, 2022 · 4 comments
Labels

Comments

@phwuil
Copy link

phwuil commented Jan 6, 2022

  • I have read the Filing Issues and subsequent “How to Get Help” sections of the documentation.

  • I have searched the issues (including closed ones) and believe that this is not a duplicate.

  • OS version and name: Manjaro Linux 21.2.1

  • Python version: 3.10.1

  • Pelican version: pelican==4.7.1

  • Markdown: Markdown==3.3.6

Issue

Hi,

It seems that Markdown has deprecated (and even removed) the extension headerid (https://python-markdown.github.io/change_log/release-3.0/#headerid-extension-deprecated).

When trying to generate my site with pelican (make html), I received this error message for each .md file :

ERROR    Could not process pages/home.md                                                                                                log.py:96
No module named 'markdown.extensions.headerid'

Thanks !

@phwuil phwuil added the bug label Jan 6, 2022
@justinmayer
Copy link
Member

Pelican's default MARKDOWN configuration can be found in Docs > Settings > MARKDOWN. As you will see there, the default configuration does not contain any reference to the headerid extension, so the most like culprit is a misconfigured MARKDOWN setting in your Pelican configuration file.

@justinmayer
Copy link
Member

Hi @phwuil. If you need further assistance with this issue, please comment here and let us know.

@meonkeys
Copy link

meonkeys commented May 25, 2024

This worked for me in my pelicanconf.py:

MARKDOWN = {
    'extension_configs': {
        'markdown.extensions.codehilite': {'css_class': 'highlight'},
        'markdown.extensions.extra': {},
        'markdown.extensions.meta': {},
        'markdown.extensions.toc': {'permalink': True},
    },
    'output_format': 'html5',
}

That combines the default MARKDOWN settings and pilcrow permalinks next to headers. See https://python-markdown.github.io/extensions/toc/ and https://docs.getpelican.com/en/latest/settings.html#basic-settings . I was confused that the toc extension doesn't add a table of contents by default, but it does add anchors for headers (and this is what I wanted). It only adds the ToC if you include [TOC].

meonkeys added a commit to meonkeys/shb that referenced this issue May 25, 2024
also add pilcrow permalinks

See:

* https://python-markdown.github.io/extensions/toc/
* https://docs.getpelican.com/en/latest/settings.html#basic-settings

Sorta related, not really, just saving for later:

* https://stackoverflow.com/questions/63788415/show-header-permalink-on-hover-pelican (that's about restructuredText, but there is some info about markdown, although it is incomplete as is leaves out defaults)
* getpelican/pelican-plugins#1397 (repo is deprecated)
* getpelican/pelican#2968 (added some helpful info for next person searching)
@egberts
Copy link
Contributor

egberts commented Jun 22, 2024

I enjoy the following settings just so that others can see what is out there.

MARKDOWN = {
  'extension_configs': {
    'markdown.extensions.smarty': {},
    'markdown.extensions.extra': {},
    'markdown.extensions.footnotes': {},
    'markdown.extensions.meta': {},
    'markdown.extensions.toc': {'baselevel': 1},
    'markdown.extensions.codehilite': {'css_class': 'codehilite'}
  },
  'output_format': 'html5'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants