bubkoo / hexo-toc

📖 Insert a markdown TOC before posts be rendered.
MIT License
127 stars 17 forks source link

Problem with html tags in headers #17

Open Mehran-Baghi opened 7 years ago

Mehran-Baghi commented 7 years ago

Hi There is a problem with adding html tags in a header. For example this headers anchor link wont work:

## <em>something</em>

The reason is that hexo-toc makes different ids for the anchor and the link. In this example it makes a link to #emsomethingem anchor (which does not exist) and on the other hand it makes the #something anchor.

I need to add html tags to add Font Awesome.

tea3 commented 7 years ago

@Mehran-Baghi This is probably caused by markdown-toc .
https://github.com/bubkoo/hexo-toc/blob/master/package.json#L33 Why do not you ask questions with markdown-toc ?

Also , if you want to add fontawesome, can you solve it with css ? For example, the following page is helpful. https://stackoverflow.com/questions/13354578/custom-li-list-style-with-font-awesome-icon

Mehran-Baghi commented 7 years ago

Hello @tea3 Thank you for your comment. You're right it's probably a bug of markdown-toc.

And that stackoverflow post doesn't solve my problem. I have added font-awesome to my site but I want to have hexo-toc generate my toc correctly with html tags included.

By the way you're a great photographer 👌

tea3 commented 7 years ago

Thank you , I'm glad you like it : )

I have added font-awesome to my site but I want to have hexo-toc generate my toc correctly with html tags included.

I see . I think that markdown-toc doesn't assume such usage. I recommend that you request for markdown-toc to escape html tag .