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) {
|
||||
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,
|
||||
|
|
Loading…
Reference in a new issue