diff --git a/src/misc.ts b/src/misc.ts index 6450177..da886a4 100644 --- a/src/misc.ts +++ b/src/misc.ts @@ -177,7 +177,7 @@ export const applyRules = (data: string, rules: ApplyRule[]): string => { /** Removes trailing whitespace before the closing tag of block-level elements (`h1`–`h6`, `li`, `td`, `th`). */ export const trimElementWhitespace = (str: string): string => - str.replaceAll(/\s+(<\/(?:h[1-6]|li|td|th)>)/g, '$1') + str.replaceAll(/\s+(?=<\/(?:h[1-6]|li|td|th)>)/g, '') /** * Walks `tagRe` forward from `start`, tracking open/close depth, and returns the index