소스 검색

fix: exclude non-class attributes from markdown rendering in editor preview (#1251)

Hinaloe 5 년 전
부모
커밋
115472a3fc
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      client/components/editor/editor-markdown.vue

+ 3 - 1
client/components/editor/editor-markdown.vue

@@ -233,7 +233,9 @@ const md = new MarkdownIt({
     return `<pre class="line-numbers"><code class="language-${lang}">${str}</code></pre>`
   }
 })
-  .use(mdAttrs)
+  .use(mdAttrs, {
+    allowedAttributes: ['id', 'class', 'target']
+  })
   .use(mdEmoji)
   .use(mdTaskLists, {label: true, labelAfter: true})
   .use(mdExpandTabs)