1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-11 08:56:02 +00:00

Added in a function to sanatize script tags specifically

This commit is contained in:
Scott Tolksdorf
2018-11-26 19:46:51 -05:00
committed by Rae2che5
parent 8b04cc9269
commit 20b719d0de
2 changed files with 10 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown",
"version": "2.8.0",
"version": "2.8.1",
"repository": {
"type": "git",
"url": "git://github.com/stolksdorf/homebrewery.git"

View File

@@ -13,6 +13,11 @@ renderer.html = function (html) {
return html;
};
const sanatizeScriptTags = (content)=>{
return content
.replace(/<script/g, '&lt;script')
.replace(/<\/script>/g, '&lt;/script&gt;');
};
const tagTypes = ['div', 'span', 'a'];
const tagRegex = new RegExp(`(${
@@ -24,7 +29,10 @@ const tagRegex = new RegExp(`(${
module.exports = {
marked : Markdown,
render : (rawBrewText)=>{
return Markdown(rawBrewText, { renderer: renderer });
return Markdown(
sanatizeScriptTags(rawBrewText),
{ renderer: renderer }
);
},
validate : (rawBrewText)=>{