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

feature request(headerid): Markdown support #1397

Open
Kristinita opened this issue Jan 6, 2024 · 1 comment
Open

feature request(headerid): Markdown support #1397

Kristinita opened this issue Jan 6, 2024 · 1 comment

Comments

@Kristinita
Copy link
Contributor

@ionelmc, @albertodonato, @stevepiercy

1. Summary

It would be nice if Markdown users can use headerid.

2. MCVE

2.1. The part of pelicanconf.py

PLUGINS = [
    'headerid'
]

2.2. KiraArticle.md

Title: KiraArticle
Date: 2020-09-24 18:57:33

<!-- MarkdownTOC -->

1. [**Кира Богиня!**](#Кира-Богиня)

<!-- /MarkdownTOC -->

<a id="Кира-Богиня"></a>
# Кира Богиня!

Kira Goddess!

2.3. Command

pelican content -s pelicanconf.py --ignore-cache

2.4. Behavior

2.4.1. Current

headerid doesn’t add permalink.

<p><a id="Кира-Богиня"></a></p>
<h1>Кира Богиня!</h1>
2.4.2. Desired

Adding permalink.

<p><a id="Кира-Богиня"></a></p>
<h1>Кира Богиня! <a class="headerlink" href="#Кира-Богиня" title="Permalink to this headline">*</a></h1>

3. Markdown TOC plugin

From headerid documentation:

For Markdown, this plugin is less relevant since the Python-Markdown library includes a Table of Contents extension that will generate link anchors. To enable the toc extension, add a line similar to the following example to your Pelican settings file

But I use MarkdownTOC Sublime Text package instead of “Table of Contents” Python Markdown extension. I can use “Table of Contents” Python Markdown extension, adding to my pelicanconf.py these lines:

MARKDOWN = {
    'extension_configs': {
        'markdown.extensions.toc': {
            'permalink': 'true'
        },
    },
    'output_format': 'html5',
}

But I get in the output:

<h1 id="_1">Кира Богиня!<a class="headerlink" href="#_1" title="Permanent link">&para;</a></h1>

“Table of Contents” doesn’t support non-ASCII symbols in headers. It adds href="#_1" instead of href="#Кира-Богиня". Also in “Table of Contents”, unlike MarkdownTOC, users haven’t ability to determine which characters to remove from id. “Table of Contents” doesn’t have other MarkdownTOC options.

I don’t think that “Table of Contents” is a better solution, and I think it would be nice if the headerid plugin could be used by Markdown users who don’t use “Table of Contents”.

Thanks.

@meonkeys
Copy link

Seems like this issue should be moved/copied to https://github.com/Python-Markdown/markdown/issues , and retitled to reflect the i18n/L10n focus.

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants