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

hexo-toc plugin conflicts with toc helper in EJS templates #26

Open
bennycode opened this issue Dec 20, 2020 · 2 comments
Open

hexo-toc plugin conflicts with toc helper in EJS templates #26

bennycode opened this issue Dec 20, 2020 · 2 comments

Comments

@bennycode
Copy link
Contributor

In the EJS template of my posts, I am using Hexo's native TOC helper:

<%- toc(page.content) %>

And in some content of my pages, I am using the TOC placeholder of this plugin (hexo-toc):

<!-- toc -->

The TOC helper in my posts works fine when "hexo-toc" is not installed but if I install "hexo-toc" it renders TOCs in my Markdown files but also affects the rendering of my TOC helper. I noticed that the TOC rendered by my EJS template gets shown but the links are not working when "hexo-toc" is installed.

Here is my "hexo-toc" config:

"toc": {
  "class": "toc",
  "decodeEntities": false,
  "maxdepth": 2,
  "slugify": "transliteration"
}

My Hexo.js version is 5.2.0.

@bennycode
Copy link
Contributor Author

@bubkoo can you help me getting your plugin to run on my website https://typescript.tv/?

@bennycode
Copy link
Contributor Author

After some coding I found the problem... The slug generation is different. Hexo internally uses "slugize" from "hexo-util". I created a PR to allow this option: #29

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

1 participant