Commit 1ac8a9d1 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'fhmurakami-v-safe-html-latex' into 'master'

Switch to v-safe-html in latex

See merge request gitlab-org/gitlab!72733
parents 6665b71e 45bbf84f
<script> <script>
import { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import 'mathjax/es5/tex-svg'; import 'mathjax/es5/tex-svg';
import Prompt from '../prompt.vue'; import Prompt from '../prompt.vue';
...@@ -7,6 +8,9 @@ export default { ...@@ -7,6 +8,9 @@ export default {
components: { components: {
Prompt, Prompt,
}, },
directives: {
SafeHtml,
},
props: { props: {
count: { count: {
type: Number, type: Number,
...@@ -33,13 +37,16 @@ export default { ...@@ -33,13 +37,16 @@ export default {
return svg.outerHTML; return svg.outerHTML;
}, },
}, },
safeHtmlConfig: {
// to support SVGs and custom tags for mathjax
ADD_TAGS: ['use', 'mjx-container', 'mjx-tool', 'mjx-status', 'mjx-tip'],
},
}; };
</script> </script>
<template> <template>
<div class="output"> <div class="output">
<prompt type="Out" :count="count" :show-output="index === 0" /> <prompt type="Out" :count="count" :show-output="index === 0" />
<!-- eslint-disable --> <div ref="maths" v-safe-html:[$options.safeHtmlConfig]="code"></div>
<div ref="maths" v-html="code"></div>
</div> </div>
</template> </template>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment