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:
+5
-1
@@ -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, '​_');
|
||||
}
|
||||
return '<h'+level+'>'+(textWithLineBreaks ? textWithLineBreaks : text)+'</h'+level+'>';
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user