Skip to content

Commit

Permalink
fix: remove hl classes on export correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sidvishnoi committed Jan 10, 2025
1 parent 0aec3c1 commit 72f6118
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/core/highlight-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ export async function run(conf) {
// remove highlights, cleanup empty class/style attributes
sub("beforesave", (/** @type {Document} */ outputDoc) => {
outputDoc.querySelectorAll("var.respec-hl").forEach(el => {
for (const cls of el.classList.values()) {
if (cls.startsWith("respec-hl")) {
el.classList.remove(cls);
}
}
[...el.classList.values()]
.filter(cls => cls.startsWith("respec-hl"))
.forEach(cls => el.classList.remove(cls));
if (!el.classList.length) el.removeAttribute("class");
});
});
Expand Down

0 comments on commit 72f6118

Please sign in to comment.