Revert "Removes trailing dash from generated slugs in markdown (#3044)"
This reverts commit 8530cce14f
.
This commit is contained in:
parent
4555c8cb0b
commit
f5c9d8e829
3 changed files with 2 additions and 11 deletions
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
'@astrojs/markdown-remark': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
fixed generated slugs in markdown that ends with a dash
|
|
|
@ -53,11 +53,7 @@ export default function createCollectHeaders() {
|
||||||
node as any
|
node as any
|
||||||
).value = `<${node.tagName} id={${node.properties.id}}>${raw}</${node.tagName}>`;
|
).value = `<${node.tagName} id={${node.properties.id}}>${raw}</${node.tagName}>`;
|
||||||
} else {
|
} else {
|
||||||
let slug = slugger.slug(text);
|
node.properties.id = slugger.slug(text);
|
||||||
|
|
||||||
if (slug.endsWith('-')) slug = slug.slice(0, -1);
|
|
||||||
|
|
||||||
node.properties.id = slug;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ describe('expressions', () => {
|
||||||
chai
|
chai
|
||||||
.expect(code)
|
.expect(code)
|
||||||
.to.equal(
|
.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>'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue