Double newlines between all the things

This commit is contained in:
Will Boyd
2024-02-21 15:24:07 -05:00
parent 06ee39c545
commit b1625f7700
+4 -2
View File
@@ -55,12 +55,14 @@ function initTurndownService() {
}
});
// preserve <figure> and <figcaption>
// preserve <figure> and <figcaption> -- the extra newlines between tags are
// necessary because of how markdown is being used inside HTML tags
turndownService.addRule('fig', {
filter: ['figure', 'figcaption'],
replacement: (content, node) => {
const tagName = node.nodeName.toLowerCase();
return '<' + tagName + '>' + content + '</' + tagName + '>';
const result = '\n\n<' + tagName + '>\n\n' + content + '\n\n</' + tagName + '>\n\n';
return result.replace('\n\n\n\n', '\n\n'); // reduce quadruple newlines
}
});