mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 20:23:39 +00:00
Workaround for unclosed <pre> blocks before rendering.
Unsure if this is a fix you really need but it resolves the issue posted.
This commit is contained in:
@@ -922,6 +922,18 @@ const globalVarsList = {};
|
|||||||
let varsQueue = [];
|
let varsQueue = [];
|
||||||
let globalPageNumber = 0;
|
let globalPageNumber = 0;
|
||||||
|
|
||||||
|
const closePre = (text)=>{
|
||||||
|
const cols = text.split(/^\\column$/gm);
|
||||||
|
if((cols[0].match(/```/g)||[]).length % 2 != 0) {
|
||||||
|
// Catch inserted column pattern
|
||||||
|
if(cols[0].endsWith('\n\n \n')) {
|
||||||
|
cols[0] = cols[0].slice(0, cols[0].length-'\n\n \n'.length);
|
||||||
|
cols[0] += '\n```\n\n \n';
|
||||||
|
} else cols[0] += '\n```\n';
|
||||||
|
}
|
||||||
|
return cols.join(`\n\\column\n`);
|
||||||
|
};
|
||||||
|
|
||||||
const Markdown = {
|
const Markdown = {
|
||||||
marked : Marked,
|
marked : Marked,
|
||||||
render : (rawBrewText, pageNumber=0)=>{
|
render : (rawBrewText, pageNumber=0)=>{
|
||||||
@@ -932,7 +944,7 @@ const Markdown = {
|
|||||||
MarkedGFMResetHeadingIDs();
|
MarkedGFMResetHeadingIDs();
|
||||||
}
|
}
|
||||||
|
|
||||||
rawBrewText = rawBrewText.replace(/^\\column$/gm, `\n<div class='columnSplit'></div>\n`);
|
rawBrewText = closePre(rawBrewText).replace(/^\\column$/gm, `\n<div class='columnSplit'></div>\n`);
|
||||||
|
|
||||||
const opts = Marked.defaults;
|
const opts = Marked.defaults;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user