feature request(headerid): Markdown support
Opened this issue · 1 comments
@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">¶</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.
Seems like this issue should be moved/copied to https://github.com/Python-Markdown/markdown/issues , and retitled to reflect the i18n/L10n focus.