Skip to content

Commit

Permalink
Merge pull request #2392 from alexandrevryghem/fix-mathjax-displaying…
Browse files Browse the repository at this point in the history
…-twiced-in-ui_contribute-maintenance-7.6

[Port dspace-7_x] Fixed MathJax code being displayed twice by `dsMarkdown` pipe
  • Loading branch information
tdonohue authored Aug 3, 2023
2 parents 99c6dd1 + 15656b0 commit 99e349b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/app/shared/utils/markdown.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export class MarkdownPipe implements PipeTransform {
// sanitize-html doesn't let through SVG by default, so we extend its allowlists to cover MathJax SVG
allowedTags: [
...sanitizeHtml.defaults.allowedTags,
'mjx-container', 'svg', 'g', 'path', 'rect', 'text'
'mjx-container', 'svg', 'g', 'path', 'rect', 'text',
// Also let the mjx-assistive-mml tag (and it's children) through (for screen readers)
'mjx-assistive-mml', 'math', 'mrow', 'mi',
],
allowedAttributes: {
...sanitizeHtml.defaults.allowedAttributes,
Expand All @@ -88,7 +90,16 @@ export class MarkdownPipe implements PipeTransform {
],
text: [
'transform', 'font-size'
]
],
'mjx-assistive-mml': [
'unselectable', 'display', 'style',
],
math: [
'xmlns',
],
mrow: [
'data-mjx-texclass',
],
},
parser: {
lowerCaseAttributeNames: false,
Expand Down

0 comments on commit 99e349b

Please sign in to comment.