Build: Fix minor whitespace issues

This commit is contained in:
Ben Edgington
2025-06-21 18:55:37 +01:00
parent bb874f7b30
commit acd042fa27
2 changed files with 16 additions and 2 deletions

View File

@@ -10,6 +10,20 @@ function cleanupHtml() {
delete node.properties['is:raw'];
return CONTINUE;
}
// Remove whitespace at the end of headings. This can be left by section marker comments.
if (node.type === 'text') {
if (
parent.type === 'element' &&
(parent.tagName === 'h1' ||
parent.tagName === 'h2' ||
parent.tagName === 'h3')
) {
node.value = node.value.trim();
}
return CONTINUE;
}
// Remove all comments
if (node.type === 'comment') {
parent.children.splice(index, 1);