Skip to content
代码片段 群组 项目
提交 44090f41 编辑于 作者: Abhijeet Chatterjee's avatar Abhijeet Chatterjee 提交者: Kushal Pandya
浏览文件

Refactor-v-html-markdown.vue

上级 702529c4
No related branches found
No related tags found
无相关合并请求
<script>
import katex from 'katex';
import marked from 'marked';
import { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import { sanitize } from '~/lib/dompurify';
import { hasContent, markdownConfig } from '~/lib/utils/text_utility';
import Prompt from './prompt.vue';
......@@ -138,6 +139,9 @@ export default {
components: {
prompt: Prompt,
},
directives: {
SafeHtml,
},
inject: ['relativeRawPath'],
props: {
cell: {
......@@ -150,16 +154,17 @@ export default {
renderer.attachments = this.cell.attachments;
renderer.relativeRawPath = this.relativeRawPath;
return sanitize(marked(this.cell.source.join('').replace(/\\/g, '\\\\')), markdownConfig);
return marked(this.cell.source.join('').replace(/\\/g, '\\\\'));
},
},
markdownConfig,
};
</script>
<template>
<div class="cell text-cell">
<prompt />
<div class="markdown" v-html="markdown /* eslint-disable-line vue/no-v-html */"></div>
<div v-safe-html:[$options.markdownConfig]="markdown" class="markdown"></div>
</div>
</template>
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册