hexo-renderer-marked icon indicating copy to clipboard operation
hexo-renderer-marked copied to clipboard

[Improvment] Definition of the order of the anchors within the page is not consistent with Typora

Open Pil0tXia opened this issue 2 years ago • 3 comments

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

Pil0tXia avatar Dec 15 '22 12:12 Pil0tXia

Relevant code https://github.com/hexojs/hexo-renderer-marked/blob/d10fd5f50694df6f27e83d2fe760bc38675a6528/lib/renderer.js#L45-L50

stevenjoezhang avatar Dec 15 '22 18:12 stevenjoezhang

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

uiolee avatar Sep 12 '23 11:09 uiolee

This issue is not easy to solve because we don't know if there will be duplicates when generating first header.

stevenjoezhang avatar Apr 16 '24 16:04 stevenjoezhang