hexojs / hexo-renderer-markdown-it

Markdown-it is a Markdown parser, done right. A faster and CommonMark compliant alternative for Hexo.
MIT License
340 stars 60 forks source link

fix: clear title cache after rendering of a post #184

Closed renbaoshuo closed 1 year ago

renbaoshuo commented 1 year ago

Problem

After #135, using the same heading in different posts caused the rendered posts' anchor id to be add unnecessarily suffixes.

Reproduction

_posts/post-1.md

---
title: Post 1
---

## Development

## Production

will be rendered to:

<h2 id="Development">Development</h2>
<h2 id="Production">Production</h2>

_posts/post-2.md

---
title: Post 2
---

## Development

## Production

will be rendered to:

<h2 id="Development-2">Development</h2>
<h2 id="Production-2">Production</h2>

actually the result should as same as _posts/post-1.md.

renbaoshuo commented 1 year ago

Should we release a new version after merge this PR?

yoshinorin commented 1 year ago

Should we release a new version after merge this PR?

Ready #185