Closed noraj closed 4 years ago
Currently permalinks are added as a link inside the title
I assume you enabled permalink
? It's disabled by default in v4 (of this plugin).
markdown:
anchors:
permalink: true
The problem is the permalink symbol will be part of the title.
What is the expected behavior?
Show permalink symbol in heading, but not in toc?
I assume you enabled
permalink
? It's disabled by default in v4 (of this plugin).
Yeah I enabled permalink
because I want them.
What is the expected behavior?
Show permalink symbol in heading, but not in toc?
Exactly. I see you confirmed the issue is coming from cheerio (https://github.com/hexojs/hexo-util/issues/174#issuecomment-573373405).
Issue / current behavior
Currently permalinks are added as a link inside the title, for example:
This will produce something like:
The problem is the permalink symbol will be part of the title.
So when you use, for example, the
toc
helper, the permalink symbol will be added in the title too.Idea of fixing / workaround
My workaround was to set a null symbol
permalinkSymbol: ''
and to add some css (sass here):So this display the same and is still clickable but there is no more content in the title.
Same look
No more issue with the toc helper
But I think it can't be fixed like this because this plugin only generates html, no css.
Alternative idea
Fix the toc helper to select only text content and not other sub-elements like links.
https://github.com/hexojs/hexo/issues/4057
Environment
Happening with both hexo: 4.2.0 and hexo: 4.1.1