Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed MathJax code being displayed twice by dsMarkdown pipe #2397

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading