Skip to content

Commit 35d8738

Browse files
💄 style: Fix shiki theme (resolve #292)
1 parent f5bec3e commit 35d8738

File tree

4 files changed

+120
-2047
lines changed

4 files changed

+120
-2047
lines changed

package.json

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,21 @@
9292
]
9393
},
9494
"dependencies": {
95-
"@ant-design/cssinjs": "^1.22.1",
95+
"@ant-design/cssinjs": "^1.23.0",
9696
"@dnd-kit/core": "^6.3.1",
9797
"@dnd-kit/modifiers": "^9.0.0",
9898
"@dnd-kit/sortable": "^10.0.0",
9999
"@dnd-kit/utilities": "^3.2.2",
100100
"@emoji-mart/data": "^1.2.1",
101101
"@emoji-mart/react": "^1.1.1",
102-
"@floating-ui/react": "^0.27.3",
102+
"@floating-ui/react": "^0.27.5",
103103
"@giscus/react": "^3.1.0",
104104
"@lobehub/fluent-emoji": "^1.2.0",
105-
"@lobehub/icons": "^1.62.0",
105+
"@lobehub/icons": "^1.89.0",
106106
"@mdx-js/mdx": "^3.1.0",
107107
"@mdx-js/react": "^3.1.0",
108-
"@radix-ui/react-slot": "^1.1.1",
109-
"@shikijs/transformers": "^1.26.1",
108+
"@radix-ui/react-slot": "^1.1.2",
109+
"@shikijs/transformers": "^3.2.1",
110110
"@splinetool/runtime": "0.9.526",
111111
"ahooks": "^3.8.4",
112112
"antd-style": "^3.7.1",
@@ -116,77 +116,77 @@
116116
"emoji-mart": "^5.6.0",
117117
"fast-deep-equal": "^3.1.3",
118118
"immer": "^10.1.1",
119-
"leva": "^0.9.35",
119+
"leva": "^0.9.36",
120120
"lodash-es": "^4.17.21",
121121
"lucide-react": "^0.475.0",
122-
"mermaid": "^11.4.1",
122+
"mermaid": "^11.5.0",
123123
"numeral": "^2.0.6",
124124
"polished": "^4.3.1",
125125
"query-string": "^9.1.1",
126126
"rc-footer": "^0.6.8",
127-
"re-resizable": "^6.10.3",
127+
"re-resizable": "^6.11.2",
128128
"react-avatar-editor": "^13.0.2",
129129
"react-error-boundary": "^5.0.0",
130130
"react-layout-kit": "^1.9.1",
131-
"react-markdown": "^9.0.3",
131+
"react-markdown": "^9.1.0",
132132
"react-merge-refs": "^2.1.1",
133-
"react-rnd": "^10.4.14",
133+
"react-rnd": "^10.5.2",
134134
"rehype-katex": "^7.0.1",
135135
"rehype-raw": "^7.0.0",
136136
"remark-breaks": "^4.0.0",
137-
"remark-gfm": "^4.0.0",
137+
"remark-gfm": "^4.0.1",
138138
"remark-math": "^6.0.0",
139-
"shiki": "^1.26.1",
140-
"swr": "^2.3.0",
139+
"shiki": "^3.2.1",
140+
"swr": "^2.3.3",
141141
"ts-md5": "^1.3.1",
142142
"unified": "^11.0.5",
143143
"url-join": "^5.0.0",
144144
"use-merge-value": "^1.2.0",
145-
"uuid": "^11.0.4"
145+
"uuid": "^11.1.0"
146146
},
147147
"devDependencies": {
148-
"@ant-design/icons": "^5.5.2",
149-
"@commitlint/cli": "^19.6.1",
150-
"@lobehub/lint": "^1.25.4",
151-
"@testing-library/react": "^16.1.0",
152-
"@types/chroma-js": "^3.1.0",
148+
"@ant-design/icons": "^5.6.1",
149+
"@commitlint/cli": "^19.8.0",
150+
"@lobehub/lint": "^1.25.7",
151+
"@testing-library/react": "^16.2.0",
152+
"@types/chroma-js": "^3.1.1",
153153
"@types/lodash-es": "^4.17.12",
154154
"@types/mdx": "^2.0.13",
155155
"@types/numeral": "^2.0.5",
156156
"@types/pangu": "^4.0.2",
157-
"@types/react": "^19.0.4",
158-
"@types/react-avatar-editor": "^13.0.3",
159-
"@types/react-dom": "^19.0.2",
157+
"@types/react": "^19.0.12",
158+
"@types/react-avatar-editor": "^13.0.4",
159+
"@types/react-dom": "^19.0.4",
160160
"@types/unist": "^3.0.3",
161161
"@types/uuid": "^10.0.0",
162-
"@vitest/coverage-v8": "^3",
163-
"antd": "^5.23.0",
162+
"@vitest/coverage-v8": "^3.0.9",
163+
"antd": "^5.24.4",
164164
"babel-plugin-antd-style": "^1.0.4",
165165
"clean-package": "^2.2.0",
166-
"commitlint": "^19.6.1",
166+
"commitlint": "^19.8.0",
167167
"concurrently": "^9.1.2",
168168
"cross-env": "^7.0.3",
169169
"dpdm": "^3.14.0",
170-
"dumi": "^2.4.17",
170+
"dumi": "^2.4.18",
171171
"dumi-theme-lobehub": "^1.15.0",
172172
"eslint": "^8.57.1",
173-
"father": "^4.5.1",
173+
"father": "^4.5.2",
174174
"husky": "^9.1.7",
175175
"jsdom": "^26.0.0",
176-
"lint-staged": "^15.3.0",
176+
"lint-staged": "^15.5.0",
177177
"mdast-util-to-markdown": "^2.1.2",
178-
"prettier": "^3.4.2",
178+
"prettier": "^3.5.3",
179179
"react": "^19.0.0",
180180
"react-dom": "^19.0.0",
181181
"remark": "^15.0.1",
182182
"remark-cli": "^12.0.1",
183183
"semantic-release": "^21.1.2",
184184
"stylelint": "^15.11.0",
185-
"tsx": "^4.19.2",
186-
"typescript": "^5.7.3",
185+
"tsx": "^4.19.3",
186+
"typescript": "^5.8.2",
187187
"unist-util-is": "^6.0.0",
188188
"unist-util-visit": "^5.0.0",
189-
"vitest": "^3.0.4"
189+
"vitest": "^3.0.9"
190190
},
191191
"peerDependencies": {
192192
"antd": "^5.23.0",

src/Highlighter/demos/data.ts

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,61 @@
1-
export const code = `export default ({ children, className }: MarkdownProps) => {
2-
const { styles } = useStyles();
3-
return (
4-
<ReactMarkdown
5-
className={cx(styles.container, className)}
6-
components={{ pre: CodeBlock, code: Code }}
7-
>
8-
{children}
9-
</ReactMarkdown>
10-
);
11-
}`;
1+
export const code = `import { useTheme } from 'antd-style';
2+
import mermaid from 'mermaid';
3+
import { useCallback, useEffect, useState } from 'react';
4+
5+
export const useMermaid = (content: string) => {
6+
const [mermaidContent, setMermaidContent] = useState<string>();
7+
const theme = useTheme();
8+
useEffect(() => {
9+
mermaid.initialize({
10+
fontFamily: theme.fontFamilyCode,
11+
gantt: {
12+
useWidth: 1920,
13+
},
14+
securityLevel: 'loose',
15+
startOnLoad: true,
16+
theme: theme.isDarkMode ? 'dark' : 'default',
17+
themeVariables: {
18+
errorBkgColor: theme.colorError,
19+
errorTextColor: theme.colorText,
20+
fontSize: 14,
21+
lineColor: theme.colorText,
22+
primaryBorderColor: theme.colorPrimaryBorder,
23+
primaryColor: theme.colorPrimaryBg,
24+
primaryTextColor: theme.colorText,
25+
secondaryColor: theme.colorInfo,
26+
tertiaryColor: theme.colorSuccess,
27+
},
28+
});
29+
mermaid.contentLoaded();
30+
}, [mermaidContent, theme.isDarkMode]);
31+
32+
const checkSyntax = async (textStr: string) => {
33+
try {
34+
if (await mermaid.parse(textStr)) {
35+
setMermaidContent(textStr);
36+
}
37+
} catch {}
38+
};
39+
40+
useEffect(() => {
41+
checkSyntax(content);
42+
}, [content]);
43+
44+
return useCallback(() => {
45+
return (
46+
<pre
47+
className={'mermaid'}
48+
style={{
49+
alignItems: 'center',
50+
display: 'flex',
51+
fontSize: 14,
52+
justifyContent: 'center',
53+
overflow: 'auto',
54+
}}
55+
>
56+
{mermaidContent}
57+
</pre>
58+
);
59+
}, [mermaidContent, theme.isDarkMode]);
60+
};
61+
`;

0 commit comments

Comments
 (0)