perf: code

This commit is contained in:
archer
2023-06-15 17:32:12 +08:00
parent bf1592d2c6
commit 6f9e929298
8 changed files with 53 additions and 17 deletions

View File

@@ -10,6 +10,7 @@ import styles from './index.module.scss';
import CodeLight from './codeLight';
import Loading from './Loading';
import MermaidCodeBlock from './MermaidCodeBlock';
import MdImage from './Image';
const Markdown = ({
source,
@@ -33,6 +34,9 @@ const Markdown = ({
rehypePlugins={[rehypeKatex]}
components={{
pre: 'div',
img({ src = '' }) {
return <MdImage src={src} />;
},
code({ node, inline, className, children, ...props }) {
const match = /language-(\w+)/.exec(className || '');