diff options
Diffstat (limited to 'packages/markdown')
-rw-r--r-- | packages/markdown/remark/src/rehype-collect-headers.ts | 6 | ||||
-rw-r--r-- | packages/markdown/remark/test/expressions.test.js | 2 |
2 files changed, 2 insertions, 6 deletions
diff --git a/packages/markdown/remark/src/rehype-collect-headers.ts b/packages/markdown/remark/src/rehype-collect-headers.ts index 50a9c5da1..f8cedd0d5 100644 --- a/packages/markdown/remark/src/rehype-collect-headers.ts +++ b/packages/markdown/remark/src/rehype-collect-headers.ts @@ -53,11 +53,7 @@ export default function createCollectHeaders() { node as any ).value = `<${node.tagName} id={${node.properties.id}}>${raw}</${node.tagName}>`; } else { - let slug = slugger.slug(text); - - if (slug.endsWith('-')) slug = slug.slice(0, -1); - - node.properties.id = slug; + node.properties.id = slugger.slug(text); } } diff --git a/packages/markdown/remark/test/expressions.test.js b/packages/markdown/remark/test/expressions.test.js index 828f70561..db351f9d8 100644 --- a/packages/markdown/remark/test/expressions.test.js +++ b/packages/markdown/remark/test/expressions.test.js @@ -54,7 +54,7 @@ describe('expressions', () => { chai .expect(code) .to.equal( - '<h1 id="-foo--is-a-shorthand-for--foo-foo"><code is:raw>{ foo }</code> is a shorthand for <code is:raw>{ foo: foo }</code></h1>' + '<h1 id="-foo--is-a-shorthand-for--foo-foo-"><code is:raw>{ foo }</code> is a shorthand for <code is:raw>{ foo: foo }</code></h1>' ); }); |