Skip to content

Commit

Permalink
[client-narratives] modify markdown parser settings
Browse files Browse the repository at this point in the history
Parsing of the narrative (YAML) frontmatter produces markdown with `<sup>` and `<sub>` 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.
  • Loading branch information
jameshadfield committed Jul 14, 2020
1 parent 7e2b9d7 commit a0cf89e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/parseMarkdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit a0cf89e

Please sign in to comment.