瀏覽代碼

fix: remove problematic Markdown optimization (via #5520)

bubble
kyle 5 年之前
committed by GitHub
父節點
當前提交
c27a613647
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 1 個檔案被更改,包括 0 行新增11 行删除
  1. +0
    -11
      src/core/components/providers/markdown.jsx

+ 0
- 11
src/core/components/providers/markdown.jsx 查看文件

@@ -15,22 +15,11 @@ DomPurify.addHook("beforeSanitizeElements", function (current, ) {
return current
})

// eslint-disable-next-line no-useless-escape
const isPlainText = (str) => /^[A-Z\s0-9!?\.]+$/gi.test(str)

function Markdown({ source, className = "" }) {
if (typeof source !== "string") {
return null
}

if(isPlainText(source)) {
// If the source text is not Markdown,
// let's save some time and just render it.
return <div className="markdown">
{source}
</div>
}

const md = new Remarkable({
html: true,
typographer: true,


Loading…
取消
儲存