Website: Update Markdown headings (#19608)

Closes: #19606

Changes:
- Updated the `to-html` helper to add optional linebreaks to all
Markdown headings that contain an underscore.
This commit is contained in:
Eric
2024-06-07 17:48:44 -05:00
committed by GitHub
parent 2a9b10855d
commit da0268eec8
+5 -1
View File
@@ -94,7 +94,11 @@ module.exports = {
};
} else {
customRenderer.heading = function (text, level) {
return '<h'+level+'>'+text+'</h'+level+'>';
var textWithLineBreaks;
if(text.match(/\S(\w+\_\S)+(\w\S)+/g) && !text.match(/\s/g)){
textWithLineBreaks = text.replace(/(\_)/g, '&#8203;_');
}
return '<h'+level+'>'+(textWithLineBreaks ? textWithLineBreaks : text)+'</h'+level+'>';
};
}