mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-12 23:35:58 +00:00
Added in a function to sanatize script tags specifically
This commit is contained in:
committed by
Rae2che5
parent
8b04cc9269
commit
20b719d0de
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"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.0",
|
"version": "2.8.1",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/stolksdorf/homebrewery.git"
|
"url": "git://github.com/stolksdorf/homebrewery.git"
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ renderer.html = function (html) {
|
|||||||
return html;
|
return html;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const sanatizeScriptTags = (content)=>{
|
||||||
|
return content
|
||||||
|
.replace(/<script/g, '<script')
|
||||||
|
.replace(/<\/script>/g, '</script>');
|
||||||
|
};
|
||||||
|
|
||||||
const tagTypes = ['div', 'span', 'a'];
|
const tagTypes = ['div', 'span', 'a'];
|
||||||
const tagRegex = new RegExp(`(${
|
const tagRegex = new RegExp(`(${
|
||||||
@@ -24,7 +29,10 @@ const tagRegex = new RegExp(`(${
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
marked : Markdown,
|
marked : Markdown,
|
||||||
render : (rawBrewText)=>{
|
render : (rawBrewText)=>{
|
||||||
return Markdown(rawBrewText, { renderer: renderer });
|
return Markdown(
|
||||||
|
sanatizeScriptTags(rawBrewText),
|
||||||
|
{ renderer: renderer }
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
validate : (rawBrewText)=>{
|
validate : (rawBrewText)=>{
|
||||||
|
|||||||
Reference in New Issue
Block a user