From a0cf89eda98cbb4f95c4667238c01c90bfde44ce Mon Sep 17 00:00:00 2001 From: james hadfield Date: Mon, 13 Jul 2020 17:04:52 +1200 Subject: [PATCH] [client-narratives] modify markdown parser settings Parsing of the narrative (YAML) frontmatter produces markdown with `` and `` HTML elements to render affiliations using superscripts. (This behavior is unchanged from parsing server-side.) The client-side markdown sanitizer settings, however, were stricter than those employed on the server, and were removing these HTML elements causing the affiliations not to be displayed. These settings are relaxed in this commit. --- src/util/parseMarkdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/parseMarkdown.js b/src/util/parseMarkdown.js index d09ef792e..9f8fcd53f 100644 --- a/src/util/parseMarkdown.js +++ b/src/util/parseMarkdown.js @@ -20,7 +20,7 @@ dompurify.addHook("afterSanitizeAttributes", (node) => { }); const ALLOWED_TAGS = ['div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'em', 'strong', 'del', 'ol', 'ul', 'li', 'a', 'img']; -ALLOWED_TAGS.push('#text', 'code', 'pre', 'hr', 'table', 'thead', 'tbody', 'th', 'tr', 'td'); +ALLOWED_TAGS.push('#text', 'code', 'pre', 'hr', 'table', 'thead', 'tbody', 'th', 'tr', 'td', 'sub', 'sup'); // We want to support SVG elements, requiring the following tags (we exclude "foreignObject", "style" and "script") ALLOWED_TAGS.push("svg", "altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform"); ALLOWED_TAGS.push("circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer");