From da0268eec855afb4fad1dbb48b4e2d656c38d1dd Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 7 Jun 2024 17:48:44 -0500 Subject: [PATCH] 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. --- website/api/helpers/strings/to-html.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/website/api/helpers/strings/to-html.js b/website/api/helpers/strings/to-html.js index 91e29a5273..5182528b98 100644 --- a/website/api/helpers/strings/to-html.js +++ b/website/api/helpers/strings/to-html.js @@ -94,7 +94,11 @@ module.exports = { }; } else { customRenderer.heading = function (text, level) { - return ''+text+''; + var textWithLineBreaks; + if(text.match(/\S(\w+\_\S)+(\w\S)+/g) && !text.match(/\s/g)){ + textWithLineBreaks = text.replace(/(\_)/g, '​_'); + } + return ''+(textWithLineBreaks ? textWithLineBreaks : text)+''; }; }