Skip to content

Commit bcf7523

Browse files
📝 更新Markdown文档,增加MDX用法示例和组件说明
- 在Markdown文档中新增了MDX的用法,允许在Markdown内容中使用JSX高亮文本,并引入第三方组件。 - 优化了Highlight和HoverText组件的样式,调整了文本颜色和添加了动画效果,提升了用户体验。 - 更新了CSS样式,增加了高亮颜色和动画效果,确保整体视觉效果更加美观。
1 parent 16f3d5b commit bcf7523

File tree

4 files changed

+74
-70
lines changed

4 files changed

+74
-70
lines changed

docs/docs/编程外的基础/Markdown.mdx

Lines changed: 50 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,61 @@ title: Markdown
44
description: Markdown和MDX的各种用法及示例
55
---
66

7-
## MDX
7+
## 拓展
88

9-
最常见的池化操作为<Highlight color="#25c2a0">最大值池化</Highlight>(Max Pooling)和<Highlight color="#25c2a0">平均值池化</Highlight>(Average Pooling)两种。
9+
### MDX
1010

11-
:::info
12-
点击下方划线文字,显示解释
13-
:::
11+
MDX 允许在 <Highlight >Markdown</Highlight> 内容中使用 <Highlight >JSX</Highlight> 来高亮文本。也可以导入例如:鼠标悬浮展示这样的<HoverText text="组件" explanation="(如交互式图表或警报),并将其嵌入到内容中。这使得编写包含组件的长篇内容变得非常有趣。"/>。
1412

15-
阿伦特的《人的境况》强调了人类<HoverText text="行动" explanation="在公共领域中通过言行展现自我、与他人互动的活动,体现人的自由与多样性。" />、<HoverText text="劳动" explanation="与生物性生存直接相关的活动,满足人类基本需求(如吃饭、繁衍)。" />和<HoverText text="工作" explanation="创造持久人造物(工具、艺术品、制度)的活动,构建&quot;人造世界&quot;" />的区别。
1613

14+
也可以加载第三方组件
1715

18-
## 拓展
16+
<MarkmapHooks initialMarkdown={`
17+
18+
# 断舍离
19+
20+
## 到底什么是断舍离
21+
22+
### 不是扔东西
23+
24+
- 扔掉废物只是敲门砖
25+
26+
### 目标
27+
28+
- 获得一种怡然自得生活方式
29+
30+
### 关键
31+
32+
- 改变看待物品的角度
33+
- 不以物品为中心,以自身为中心
34+
- 考虑自己到底是否需要
35+
36+
## 为什么断舍离不仅能整理物品,也能整理思考模式和内心?
37+
38+
### 物品
39+
40+
- 信息容器 : 承载实际用途
41+
42+
- 意义容器 : 承载感受,回忆
43+
44+
### 断舍离的过程
45+
46+
- 不仅是扔东西,而是创造空间恢复生活,情感的流动
47+
48+
## 怎样做到断舍离?
49+
50+
### 打扫
51+
52+
- 决定好从哪里开始清理
53+
- 决定每样东西去留
54+
55+
### 收纳
56+
57+
- 取决于你和家里物品"友好相处"的方法
58+
- 1 out 1 in法
59+
- one touch 法
60+
61+
`} />
1962

2063
### 数学公式
2164

@@ -72,56 +115,6 @@ DSL3_2 --> DSL3_2_2(1 out 1 in法)
72115
DSL3_2 --> DSL3_2_3(one touch 法)
73116
```
74117

75-
### 独立思维导图组件
76-
77-
<MarkmapHooks initialMarkdown={`
78-
79-
# 断舍离
80-
81-
## 到底什么是断舍离
82-
83-
### 不是扔东西
84-
85-
- 扔掉废物只是敲门砖
86-
87-
### 目标
88-
89-
- 获得一种怡然自得生活方式
90-
91-
### 关键
92-
93-
- 改变看待物品的角度
94-
- 不以物品为中心,以自身为中心
95-
- 考虑自己到底是否需要
96-
97-
## 为什么断舍离不仅能整理物品,也能整理思考模式和内心?
98-
99-
### 物品
100-
101-
- 信息容器 : 承载实际用途
102-
103-
- 意义容器 : 承载感受,回忆
104-
105-
### 断舍离的过程
106-
107-
- 不仅是扔东西,而是创造空间恢复生活,情感的流动
108-
109-
## 怎样做到断舍离?
110-
111-
### 打扫
112-
113-
- 决定好从哪里开始清理
114-
- 决定每样东西去留
115-
116-
### 收纳
117-
118-
- 取决于你和家里物品"友好相处"的方法
119-
- 1 out 1 in法
120-
- one touch 法
121-
122-
`} />
123-
124-
125118
## HTML
126119

127120
### 语音

src/components/Highlight.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from 'react';
22

3-
export default function Highlight({children, color}) {
4-
return (
3+
export default function Highlight({children, color = "var(--highlight-color)"}) {
4+
return (
55
<span
66
style={{
77
backgroundColor: color,
88
borderRadius: '2px',
9-
color: '#fff',
9+
color: '#000',
1010
padding: '0.2rem',
1111
}}>
1212
{children}

src/components/HoverText.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ export default function HoverText({ text, explanation }) {
77
<span style={{ position: 'relative', display: 'inline-block' }}>
88
<span
99
style={{
10-
textDecoration: 'underline',
11-
cursor: 'pointer',
12-
color: '#1877F2'
10+
background: 'linear-gradient(transparent 70%, #FFFF00 30%)',
1311
}}
1412
onMouseEnter={() => setIsHovering(true)}
1513
onMouseLeave={() => setIsHovering(false)}
1614
>
1715
{text}
16+
<sup style={{
17+
color: 'red',
18+
fontSize: '0.7em',
19+
marginLeft: '2px',
20+
fontWeight: 'bold'
21+
}}>?</sup>
1822
</span>
1923

2024
{isHovering && (
@@ -33,11 +37,12 @@ export default function HoverText({ text, explanation }) {
3337
width: '250px',
3438
textAlign: 'center',
3539
fontSize: '0.9rem',
40+
animation: 'fadeIn 0.3s ease-in-out',
3641
}}
3742
>
3843
{explanation}
3944
</div>
4045
)}
4146
</span>
4247
);
43-
}
48+
}

src/theme/custom.css

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
--ifm-color-primary-lightest: #a16800;
99
--ifm-color-primary-font: #000000;
1010
--ifm-code-font-size: 95%;
11+
--highlight-color: hsl(50, 100%, 50%);
1112
--site-announcement-bar-stripe-color1: hsl(167deg 68% 85%);
1213
--site-announcement-bar-stripe-color2: hsl(167deg 68% 95%);
1314
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
@@ -804,12 +805,6 @@ button,
804805
--ifm-navbar-height: 4rem;
805806
}
806807
:root {
807-
--ifm-color-primary-dark: #c32323;
808-
--ifm-color-primary-darker: #b82121;
809-
--ifm-color-primary-darkest: #981c1c;
810-
--ifm-color-primary-light: #dc3e3e;
811-
--ifm-color-primary-lighter: #de4949;
812-
--ifm-color-primary-lightest: #e46969;
813808
--ifm-code-font-size: 95%;
814809
--ifm-code-background: var(--global-colors-sky70);
815810
}
@@ -1597,3 +1592,14 @@ blockquote {
15971592
input::placeholder {
15981593
color: gray
15991594
}
1595+
1596+
@keyframes fadeIn {
1597+
from {
1598+
opacity: 0;
1599+
transform: translateY(5px) translateX(-50%);
1600+
}
1601+
to {
1602+
opacity: 1;
1603+
transform: translateY(0) translateX(-50%);
1604+
}
1605+
}

0 commit comments

Comments
 (0)