0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix markdown header issue

This commit is contained in:
Fred K. Schott 2021-03-21 22:43:28 -07:00
parent 6e4367fd49
commit e1782f9dc9

View file

@ -12,6 +12,7 @@ export function createMarkdownHeadersCollector() {
atxHeading(node: any) {
currentHeader = {};
headers.push(currentHeader);
this.buffer();
},
atxHeadingSequence(node: any) {
currentHeader.depth = this.sliceSerialize(node).length;
@ -23,10 +24,10 @@ export function createMarkdownHeadersCollector() {
exit: {
atxHeading(node: any) {
currentHeader.slug = slugger.slug(currentHeader.text);
this.resume();
this.tag(`<h${currentHeader.depth} id="${currentHeader.slug}">`);
this.raw(currentHeader.text);
this.tag(`</h${currentHeader.depth}>`);
// console.log(this.sliceSerialize(node));
},
} as any,