0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-07 16:22:42 +00:00

All fixes seem to be working?

This commit is contained in:
Trevor Buckner
2020-03-25 12:09:50 -04:00
parent b9cfc2e6af
commit 5bc948ab0a
4 changed files with 66 additions and 14 deletions

View File

@@ -9,13 +9,59 @@ renderer.html = function (html) {
let closeTag = '';
html = html.substring(html.indexOf('>')+1);
if(_.endsWith(_.trim(html), '</div>')){
closeTag = '</div>'
closeTag = '</div>';
html = html.substring(0,html.lastIndexOf('</div'));
}
return `${openTag} ${Markdown(html)} ${closeTag}`;
}
// Below may work better if we just explicitly allow <script, <pre and <style
// tags to return directly
/*if(_.startsWith(_.trim(html), '<script')){
return html;
}*/
// Allow raw HTML tags to end without a blank line if markdown is right after
if(html.includes('\n')){
let openTag = html.substring(0, html.indexOf('>')+1);
if(!_.endsWith(_.trim(html), '>')){ // If there is no closing tag, parse markdown directly after
let remainder = html.substring(html.indexOf('>')+1);
return `${openTag} ${Markdown(remainder)}`;
}
}
/*if(html.includes('\n')){
//let openTag = html.substring(0, html.indexOf('\n'));
let openTag = html.substring(0, html.indexOf('>')+1);
console.log("FULL HTML");
console.log(html);
console.log("OPEN TAG");
console.log(openTag);
let closeTag = '';
if(_.endsWith(_.trim(html), '>')){
closeTag = html.substring(html.lastIndexOf('<'));
console.log("CLOSETAG");
console.log(closeTag);
}
else {
let remainder = html.substring(html.indexOf('>')+1);
console.log("REMAINDER");
console.log(remainder);
return `${openTag} ${Markdown(remainder)}`;
}
}*/
return html;
};
/*renderer.code = function (code, infostring, escaped) {
if(code == ''){
return '<pre><code>\n</code></pre>';
}
return code;
}*/
const sanatizeScriptTags = (content)=>{
return content
.replace(/<script/ig, '&lt;script')