0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-11 11:12:44 +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

1
.gitignore vendored
View File

@@ -9,3 +9,4 @@ config/local.*
todo.md todo.md
startDB.bat startDB.bat
startMViewer.bat

View File

@@ -177,6 +177,12 @@ body {
} }
} }
//***************************** //*****************************
// * SPLIT TABLE
// *****************************/
div table+pre {
display: none;
}
//*****************************
// * NOTE // * NOTE
// *****************************/ // *****************************/
blockquote{ blockquote{
@@ -330,9 +336,8 @@ body {
//Column Break //Column Break
pre, code{ pre, code{
visibility : hidden; visibility : hidden;
-webkit-column-break-after : always; break-after : column;
break-after : always; min-height : 1px;
-moz-column-break-after : always;
} }
//Avoid breaking up //Avoid breaking up
p,blockquote,table{ p,blockquote,table{

View File

@@ -1,10 +1,10 @@
{ {
"name": "homebrewery", "name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown", "description": "Create authentic looking D&D homebrews using only markdown",
"version": "2.8.1", "version": "2.8.2",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/stolksdorf/homebrewery.git" "url": "git://github.com/naturalcrit/homebrewery.git"
}, },
"scripts": { "scripts": {
"dev": "node scripts/dev.js", "dev": "node scripts/dev.js",
@@ -36,30 +36,30 @@
] ]
}, },
"dependencies": { "dependencies": {
"babel-preset-env": "^1.1.8", "babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1", "babel-preset-react": "^6.24.1",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"codemirror": "^5.51.0", "codemirror": "^5.52.0",
"cookie-parser": "^1.4.4", "cookie-parser": "^1.4.4",
"create-react-class": "^15.6.3", "create-react-class": "^15.6.3",
"express": "^4.17.1", "express": "^4.17.1",
"jwt-simple": "^0.5.6", "jwt-simple": "^0.5.6",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"marked": "^0.8.0", "marked": "^0.8.2",
"moment": "^2.24.0", "moment": "^2.24.0",
"mongoose": "^5.7.5", "mongoose": "^5.9.2",
"nconf": "^0.10.0", "nconf": "^0.10.0",
"pico-router": "^2.1.0", "pico-router": "^2.1.0",
"react": "^16.12.0", "react": "^16.13.0",
"react-dom": "^16.12.0", "react-dom": "^16.13.0",
"shortid": "^2.2.15", "shortid": "^2.2.15",
"superagent": "^5.2.1", "superagent": "^5.2.2",
"vitreum": "^4.10.1" "vitreum": "^4.10.1"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-plugin-react": "^7.18.3", "eslint-plugin-react": "^7.19.0",
"pico-check": "^1.3.2" "pico-check": "^1.3.2"
} }
} }

View File

@@ -9,13 +9,59 @@ renderer.html = function (html) {
let closeTag = ''; let closeTag = '';
html = html.substring(html.indexOf('>')+1); html = html.substring(html.indexOf('>')+1);
if(_.endsWith(_.trim(html), '</div>')){ if(_.endsWith(_.trim(html), '</div>')){
closeTag = '</div>' closeTag = '</div>';
html = html.substring(0,html.lastIndexOf('</div'));
} }
return `${openTag} ${Markdown(html)} ${closeTag}`; 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; return html;
}; };
/*renderer.code = function (code, infostring, escaped) {
if(code == ''){
return '<pre><code>\n</code></pre>';
}
return code;
}*/
const sanatizeScriptTags = (content)=>{ const sanatizeScriptTags = (content)=>{
return content return content
.replace(/<script/ig, '&lt;script') .replace(/<script/ig, '&lt;script')