Skip to content

Commit 3834a00

Browse files
committed
style:修改鼠标移入标题样式
1 parent e2b8d85 commit 3834a00

File tree

3 files changed

+53
-35
lines changed

3 files changed

+53
-35
lines changed

website/src/pages/docs/index.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import MarkdownPreview from '@uiw/react-markdown-preview';
22
import useMdData from './../../components/useMdData';
33
import { Loader } from 'uiw';
4+
import styles from './../index.module.less';
45
export function HomePage() {
56
const { mdData, loading } = useMdData((path) => {
67
return import(`markdown-react-code-preview-loader/README${path}.md`);
78
});
89
return (
910
<Loader style={{ width: '100%' }} loading={loading} tip="loading...">
10-
<MarkdownPreview source={mdData.source} />
11+
<div>
12+
<MarkdownPreview className={styles.markdown} source={mdData.source} />
13+
</div>
1114
</Loader>
1215
);
1316
}

website/src/pages/example/index.tsx

+37-34
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import MarkdownPreview from '@uiw/react-markdown-preview';
22
import PreView from '../../components/CodeLayout';
33
import useMdData from './../../components/useMdData';
44
import { Loader } from 'uiw';
5-
5+
import styles from './../index.module.less';
66
const getMetaData = (meta: string) => {
77
if (meta) {
88
const [metaItem] = /mdx:(.[\w|:]+)/i.exec(meta) || [];
@@ -19,39 +19,42 @@ export function ExamplePage() {
1919
const { mdData, loading } = useMdData((path) => import(`./App${path}.md`));
2020
return (
2121
<Loader style={{ width: '100%' }} loading={loading} tip="loading...">
22-
<MarkdownPreview
23-
source={mdData.source}
24-
components={{
25-
code: ({ inline, node, ...props }) => {
26-
const {
27-
'data-meta': meta,
28-
noPreview,
29-
noScroll,
30-
bgWhite,
31-
noCode,
32-
codePen,
33-
codeSandboxOption,
34-
codeSandbox,
35-
...rest
36-
} = props as any;
37-
if (inline) {
38-
return <code {...props} />;
39-
}
40-
const line = node.position?.start.line;
41-
const funName = getMetaData(meta || '') || line;
42-
const Child = mdData.components[funName || ''];
43-
if (funName && typeof Child === 'function') {
44-
const copyNodes = mdData.codeBlock[funName] || '';
45-
return (
46-
<PreView code={<code {...rest} />} copyNodes={copyNodes}>
47-
<Child />
48-
</PreView>
49-
);
50-
}
51-
return <code {...rest} />;
52-
},
53-
}}
54-
/>
22+
<div>
23+
<MarkdownPreview
24+
source={mdData.source}
25+
className={styles.markdown}
26+
components={{
27+
code: ({ inline, node, ...props }) => {
28+
const {
29+
'data-meta': meta,
30+
noPreview,
31+
noScroll,
32+
bgWhite,
33+
noCode,
34+
codePen,
35+
codeSandboxOption,
36+
codeSandbox,
37+
...rest
38+
} = props as any;
39+
if (inline) {
40+
return <code {...props} />;
41+
}
42+
const line = node.position?.start.line;
43+
const funName = getMetaData(meta || '') || line;
44+
const Child = mdData.components[funName || ''];
45+
if (funName && typeof Child === 'function') {
46+
const copyNodes = mdData.codeBlock[funName] || '';
47+
return (
48+
<PreView code={<code {...rest} />} copyNodes={copyNodes}>
49+
<Child />
50+
</PreView>
51+
);
52+
}
53+
return <code {...rest} />;
54+
},
55+
}}
56+
/>
57+
</div>
5558
</Loader>
5659
);
5760
}

website/src/pages/index.module.less

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.markdown {
2+
h1,
3+
h2,
4+
h3,
5+
h4,
6+
h5,
7+
h6 {
8+
a {
9+
display: none;
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)