fix markdown header issue
This commit is contained in:
parent
6e4367fd49
commit
e1782f9dc9
1 changed files with 2 additions and 1 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue