hexo-renderer-marked
hexo-renderer-marked copied to clipboard
[Improvment] Definition of the order of the anchors within the page is not consistent with Typora
Check List
Please check followings before submitting a new feature request.
- [x] I have already read Docs page
- [x] I have already searched existing issues
Feature Request
When there are multiple duplicate titles on the page, such as three "Original", Hexo references each anchor as "#Original", "#Original-1", and "Original-2".
Whereas Typora references them as "#Original-1", "Original-2", and "#Original-3".
This causes the locally written anchor link [jump to original image](#Original-2) jumps to a different title on the web side which do not match the local one. It will jump to the second title in Typora, and to the third on the web side.
If there is no "#Original-2" on the web side, the link will not respond.
I hope you can find a way to unify it.
Thank you very much!
Others
Relevant code https://github.com/hexojs/hexo-renderer-marked/blob/d10fd5f50694df6f27e83d2fe760bc38675a6528/lib/renderer.js#L45-L50
related issue:
- https://github.com/hexojs/hexo-renderer-marked/issues/239
- https://github.com/hexojs/hexo-renderer-markdown-it/issues/196
- https://github.com/hexojs/hexo-renderer-markdown-it/issues/197
This issue is not easy to solve because we don't know if there will be duplicates when generating first header.