From 972e05bac077d8d1085d014c14d3adbf9e64906a Mon Sep 17 00:00:00 2001 From: Rairn <958414905@qq.com> Date: Thu, 23 Mar 2023 12:26:27 +0800 Subject: [PATCH] feat(Markdown): add inline highlighting --- .../antd/markdown/highlight-theme/default.less | 6 ++++++ .../core/client/src/schema-component/antd/markdown/md.ts | 2 ++ .../core/client/src/schema-component/antd/markdown/util.ts | 2 -- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/markdown/highlight-theme/default.less b/packages/core/client/src/schema-component/antd/markdown/highlight-theme/default.less index a7ee74428..cf1f8193c 100644 --- a/packages/core/client/src/schema-component/antd/markdown/highlight-theme/default.less +++ b/packages/core/client/src/schema-component/antd/markdown/highlight-theme/default.less @@ -19,6 +19,12 @@ padding: 3px 5px } + :not(pre) code { + padding: 2px 5px; + color: #d56161; + background: #f6f7f9; + } + blockquote { border-left: 4px solid #ccc; padding-left: 20px; diff --git a/packages/core/client/src/schema-component/antd/markdown/md.ts b/packages/core/client/src/schema-component/antd/markdown/md.ts index 18cba1ed5..f2389a822 100644 --- a/packages/core/client/src/schema-component/antd/markdown/md.ts +++ b/packages/core/client/src/schema-component/antd/markdown/md.ts @@ -1,6 +1,8 @@ import MarkdownIt from 'markdown-it'; import markdownItHighlightjs from 'markdown-it-highlightjs'; import mermaidPlugin from './markdown-it-plugins/mermaidPlugin'; +import './highlight-theme/default.less'; +import './highlight-theme/table.less'; const md = new MarkdownIt({ html: true, diff --git a/packages/core/client/src/schema-component/antd/markdown/util.ts b/packages/core/client/src/schema-component/antd/markdown/util.ts index 702fdb124..c41705c50 100644 --- a/packages/core/client/src/schema-component/antd/markdown/util.ts +++ b/packages/core/client/src/schema-component/antd/markdown/util.ts @@ -1,6 +1,4 @@ import { useEffect, useState } from 'react'; -import './highlight-theme/default.less'; -import './highlight-theme/table.less'; export async function parseMarkdown(text: string) { if (!text) {