diff --git a/js/mzta-utils.js b/js/mzta-utils.js index c5dbc59e..b3048c30 100644 --- a/js/mzta-utils.js +++ b/js/mzta-utils.js @@ -285,10 +285,19 @@ function convertBrToNewlines(html) { export function convertNewlinesToParagraphs(input) { return input .split('\n') - .map(line => `

${line}

`) + .map(line => `

${escapeHtml(line)}

`) .join(''); } +function escapeHtml(text) { + return text + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); +} + // This method is used to convert the model string id used in the URL // to the model string used in the webpage