question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hexo-toc seems to disable "Automatic Headline ID's" feature of hexo-renderer-markdown-it

See original GitHub issue

I’m using hexo with hexo-renderer-markdown-it plugin to get a better markdown renderer.

I also use hexo-toc to get tocs on my posts.

When I’m using both of them, the Automatic Headline ID’s feature does not work as expected.

I expect each header to be rendered as:

<h3 id="create-a-new-post"><a class="header-anchor" href="#create-a-new-post">¶</a>Create a new post</h3>

and headers are rendered as:

<h3><span id="create-a-new-post">Create a new post</span></h3>

I can make further tests, but I need help to find out where does this behaviour comes from.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
norajcommented, May 10, 2018

It works with the following config

## Docs: https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki/
markdown:
  render:
    linkify: true
    html: true
  anchors:
    level: 1 # Minimum level for ID creation. (Ex. h2 to h6)
    collisionSuffix: 'v' # A suffix that is prepended to the number given if the ID is repeated
    permalink: false # If `true`, creates an anchor tag with a permalink besides the heading
    permalinkClass: header-anchor # Class used for the permalink anchor tag
    permalinkSymbol: '¶' # The symbol used to make the permalink

# TOC config
## https://github.com/bubkoo/hexo-toc
toc:
  maxdepth: 6
  class: toc
  anchor:
    position: after
    symbol: '¶'
    style: header-anchor
<h2><span id="team">Team</span><a href="#team" class="header-anchor">¶</a></h2>

You can’t have both permalink from hexo-renderer-markdown-it and anchor from hexo-toc.

0reactions
oupalacommented, Nov 26, 2019

As there is no answer from this repo maintainer and as this repo seems to be not maintained any more, I will try to dive into the code and to fix this bug. Any help is welcomed.

I also tried a workaround (see issue #24) pointed by @noraj but it is just a workaround that require a modification of each theme. Besides, I think that such feature should not rely on the theme, but on the blog engine and plugins.

Read more comments on GitHub >

github_iconTop Results From Across the Web

hexo-toc - Bountysource
hexo-toc seems to disable "Automatic Headline ID's" feature of ... I'm using hexo with hexo-renderer-markdown-it plugin to get a better markdown renderer.
Read more >
Helpers | Hexo
Returns a url with the root path prefixed. Output is encoded automatically. <%- url_for(path, [option]) %> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found