Skip to content

Commit

Permalink
Added in a function to sanatize script tags specifically
Browse files Browse the repository at this point in the history
  • Loading branch information
stolksdorf authored and Rae2che5 committed Dec 3, 2018
1 parent 8b04cc9 commit 20b719d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
10 changes: 9 additions & 1 deletion shared/naturalcrit/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(`(${
Expand All @@ -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)=>{
Expand Down

0 comments on commit 20b719d

Please sign in to comment.