增加对echarts图表的支持 (#249)

* 增加对echarts图表的支持

* 增加对echarts的支持
This commit is contained in:
不做了睡大觉
2023-09-04 18:17:39 +08:00
committed by GitHub
parent 5d596bd3d5
commit 32f482b232
6 changed files with 71 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ import CodeLight from './CodeLight';
const MermaidCodeBlock = dynamic(() => import('./img/MermaidCodeBlock'));
const MdImage = dynamic(() => import('./img/Image'));
const ChatGuide = dynamic(() => import('./chat/Guide'));
const EChartsCodeBlock = dynamic(() => import('./img/EChartsCodeBlock'));
function Code({ inline, className, children }: any) {
const match = /language-(\w+)/.exec(className || '');
@@ -26,7 +27,9 @@ function Code({ inline, className, children }: any) {
if (codeType === 'guide') {
return <ChatGuide text={String(children)} />;
}
if (codeType === 'echarts') {
return <EChartsCodeBlock code={String(children)} />;
}
return (
<CodeLight className={className} inline={inline} match={match}>
{children}