Skip to content

Commit

Permalink
refactor(parser): Highlight special close-implies-open logic (#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
vassudanagunta committed Dec 17, 2021
1 parent 3bafecc commit 99be0df
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Parser.ts
Expand Up @@ -334,14 +334,15 @@ export class Parser {
}
} else this.stack.length = pos;
} else if (!this.options.xmlMode && name === "p") {
this.emitOpenTag(name);
// Implicit open before close
this.emitOpenTag("p");
this.closeCurrentTag(true);
}
} else if (!this.options.xmlMode && name === "br") {
// We can't go through `emitOpenTag` here, as `br` would be implicitly closed.
this.cbs.onopentagname?.(name);
this.cbs.onopentag?.(name, {}, true);
this.cbs.onclosetag?.(name, false);
// We can't use `emitOpenTag` for implicit open, as `br` would be implicitly closed.
this.cbs.onopentagname?.("br");
this.cbs.onopentag?.("br", {}, true);
this.cbs.onclosetag?.("br", false);
}

// Set `startIndex` for next node
Expand Down

0 comments on commit 99be0df

Please sign in to comment.