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