0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-19 03:22:45 +00:00

Short term fix for the colons in codeblocks issue.

This commit is contained in:
David Bolack
2024-08-18 21:52:29 -05:00
parent 31fcf28e3f
commit 184f182b3a

View File

@@ -69,6 +69,20 @@ renderer.html = function (html) {
return html; return html;
}; };
renderer.code = function(code, infostring, escaped) {
const lang = (infostring || '').match(/^\S*/)?.[0];
code = code.replace(/<div class='blank'><\/div>/gm, (match)=>`${`:`}`);
code = `${code.replace(/\n$/, '')}\n`;
if(!lang) {
return `<pre><code>${escaped ? code : escape(code, true)}</code></pre>\n`;
}
return `<pre><code class="language-${escape(lang)}">${escaped ? code : escape(code, true)}</code></pre>\n`;
};
// Don't wrap {{ Spans alone on a line, or {{ Divs in <p> tags // Don't wrap {{ Spans alone on a line, or {{ Divs in <p> tags
renderer.paragraph = function(text){ renderer.paragraph = function(text){
let match; let match;