@umijs/plugin-docs 4.0.0-canary.20220418.2 → 4.0.0-canary.20220422.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/theme-doc/Head.tsx +28 -16
- package/client/theme-doc/Layout.tsx +23 -22
- package/client/theme-doc/Logo.tsx +5 -4
- package/client/theme-doc/NavBar.tsx +58 -15
- package/client/theme-doc/Search.tsx +1 -1
- package/client/theme-doc/Sidebar.tsx +1 -1
- package/client/theme-doc/ThemeSwitch.tsx +8 -0
- package/client/theme-doc/Toc.tsx +3 -3
- package/client/theme-doc/components/Message.tsx +31 -19
- package/client/theme-doc/context.ts +7 -1
- package/client/theme-doc/tailwind.css +108 -32
- package/client/theme-doc/tailwind.out.css +327 -130
- package/compiled/remark-gfm/index.js +1 -0
- package/compiled/remark-gfm/package.json +1 -18
- package/dist/compiler.js +26 -3
- package/dist/loader.js +13 -4
- package/package.json +12 -6
- package/compiled/remark-gfm/index.cjs +0 -15
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import cx from 'classnames';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { useThemeContext } from './context';
|
|
3
4
|
import Github from './Github';
|
|
4
5
|
import LangSwitch from './LangSwitch';
|
|
5
6
|
import Logo from './Logo';
|
|
@@ -13,27 +14,41 @@ interface HeadProps {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export default (props: HeadProps) => {
|
|
17
|
+
const { themeConfig } = useThemeContext()!;
|
|
16
18
|
return (
|
|
17
19
|
<div
|
|
18
20
|
className="w-full flex flex-row items-center justify-between
|
|
19
|
-
border-b-gray-100 border-b-2 pt-4 pb-4 px-
|
|
21
|
+
border-b-gray-100 border-b-2 pt-4 pb-4 px-4 lg:px-12 dark:border-b-gray-800"
|
|
20
22
|
>
|
|
21
|
-
<
|
|
23
|
+
<div className="flex flex-row items-center">
|
|
24
|
+
<Logo />
|
|
25
|
+
{themeConfig.extraNavLeft && <themeConfig.extraNavLeft />}
|
|
26
|
+
</div>
|
|
22
27
|
<div className="flex flex-row items-center">
|
|
23
28
|
<Search />
|
|
24
|
-
|
|
29
|
+
{/* 小屏幕显示打开菜单的按钮 */}
|
|
30
|
+
<div
|
|
31
|
+
className="block lg:hidden ml-2 cursor-pointer"
|
|
32
|
+
onClick={() => props.setMenuOpened((o) => !o)}
|
|
33
|
+
>
|
|
34
|
+
<HamburgerButton {...props} />
|
|
35
|
+
</div>
|
|
36
|
+
{/* 大屏幕显示完整的操作按钮 */}
|
|
25
37
|
<div className="hidden lg:block">
|
|
26
38
|
<NavBar />
|
|
27
39
|
</div>
|
|
28
40
|
<div className="ml-4 hidden lg:block">
|
|
29
41
|
<LangSwitch />
|
|
30
42
|
</div>
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
43
|
+
{themeConfig.themeSwitch && (
|
|
44
|
+
<div className="ml-4 hidden lg:block">
|
|
45
|
+
<ThemeSwitch />
|
|
46
|
+
</div>
|
|
47
|
+
)}
|
|
34
48
|
<div className="ml-4 hidden lg:block">
|
|
35
49
|
<Github />
|
|
36
50
|
</div>
|
|
51
|
+
{themeConfig.extraNavRight && <themeConfig.extraNavRight />}
|
|
37
52
|
</div>
|
|
38
53
|
</div>
|
|
39
54
|
);
|
|
@@ -41,30 +56,27 @@ export default (props: HeadProps) => {
|
|
|
41
56
|
|
|
42
57
|
interface HamburgerButtonProps {
|
|
43
58
|
isMenuOpened: boolean;
|
|
44
|
-
setMenuOpened: React.Dispatch<React.SetStateAction<boolean>>;
|
|
45
59
|
}
|
|
46
60
|
|
|
47
61
|
function HamburgerButton(props: HamburgerButtonProps) {
|
|
62
|
+
const { isMenuOpened } = props;
|
|
48
63
|
const barClass =
|
|
49
|
-
'
|
|
50
|
-
'
|
|
64
|
+
'absolute h-0.5 w-5 -translate-x-2.5 bg-current transform dark:bg-white ' +
|
|
65
|
+
'transition duration-500 ease-in-out';
|
|
51
66
|
|
|
52
67
|
return (
|
|
53
|
-
<div
|
|
54
|
-
className="relative py-3 sm:max-w-xl mx-auto mx-5 lg:hidden"
|
|
55
|
-
onClick={() => props.setMenuOpened((o) => !o)}
|
|
56
|
-
>
|
|
68
|
+
<div className="p-4">
|
|
57
69
|
<span
|
|
58
70
|
className={cx(
|
|
59
71
|
barClass,
|
|
60
|
-
|
|
72
|
+
isMenuOpened ? 'rotate-45 ' : '-translate-y-1.5',
|
|
61
73
|
)}
|
|
62
74
|
/>
|
|
63
|
-
<span className={cx(barClass,
|
|
75
|
+
<span className={cx(barClass, isMenuOpened && 'opacity-0')} />
|
|
64
76
|
<span
|
|
65
77
|
className={cx(
|
|
66
78
|
barClass,
|
|
67
|
-
|
|
79
|
+
isMenuOpened ? '-rotate-45' : 'translate-y-1.5',
|
|
68
80
|
)}
|
|
69
81
|
/>
|
|
70
82
|
</div>
|
|
@@ -75,31 +75,32 @@ export default (props: any) => {
|
|
|
75
75
|
id="article-body"
|
|
76
76
|
className="w-full flex flex-row justify-center overflow-x-hidden"
|
|
77
77
|
>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
{/* 左侧菜单 */}
|
|
79
|
+
<div
|
|
80
|
+
className="fixed left-0 top-0 w-1/4 flex flex-row
|
|
81
|
+
justify-center h-screen z-10 pt-20"
|
|
82
|
+
>
|
|
83
|
+
<div className="container flex flex-row justify-end">
|
|
84
|
+
<div className="hidden lg:block">
|
|
85
|
+
<Sidebar />
|
|
86
|
+
</div>
|
|
81
87
|
</div>
|
|
82
88
|
</div>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
justify-center h-screen z-10 pt-20"
|
|
88
|
-
>
|
|
89
|
-
<div className="container flex flex-row justify-end">
|
|
90
|
-
<div className="hidden lg:block">
|
|
91
|
-
<Sidebar />
|
|
89
|
+
{/* 文章内容 */}
|
|
90
|
+
<div className="container flex flex-row justify-center">
|
|
91
|
+
<div className="w-full lg:w-1/2 px-4 lg:px-2 m-8 z-20 lg:pb-12 lg:pt-6">
|
|
92
|
+
<article className="flex-1">{props.children}</article>
|
|
92
93
|
</div>
|
|
93
94
|
</div>
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
{/* 右侧 Toc */}
|
|
96
|
+
<div
|
|
97
|
+
className="fixed right-0 top-0 w-1/4 hidden lg:block flex-row
|
|
98
|
+
justify-center h-screen z-10 pt-20"
|
|
99
|
+
>
|
|
100
|
+
<div className="container flex flex-row justify-start">
|
|
101
|
+
<div className="w-2/3 top-32">
|
|
102
|
+
<Toc />
|
|
103
|
+
</div>
|
|
103
104
|
</div>
|
|
104
105
|
</div>
|
|
105
106
|
</div>
|
|
@@ -110,7 +111,7 @@ export default (props: any) => {
|
|
|
110
111
|
<div
|
|
111
112
|
className={cx(
|
|
112
113
|
'fixed top-12 w-screen bg-white z-20 dark:bg-gray-800',
|
|
113
|
-
'overflow-hidden transition-all duration-500',
|
|
114
|
+
'overflow-hidden transition-all duration-500 lg:hidden',
|
|
114
115
|
isMenuOpened ? 'max-h-screen' : 'max-h-0',
|
|
115
116
|
)}
|
|
116
117
|
>
|
|
@@ -5,14 +5,15 @@ import useLanguage from './useLanguage';
|
|
|
5
5
|
export default () => {
|
|
6
6
|
const { themeConfig, components } = useThemeContext()!;
|
|
7
7
|
const { isFromPath, currentLanguage } = useLanguage();
|
|
8
|
-
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
const { logo } = themeConfig;
|
|
8
|
+
const Logo = themeConfig.logo;
|
|
11
9
|
|
|
12
10
|
return (
|
|
13
11
|
<components.Link to={isFromPath ? '/' + currentLanguage?.locale : '/'}>
|
|
14
12
|
<div className="flex flex-row items-center">
|
|
15
|
-
|
|
13
|
+
{typeof Logo === 'string' && (
|
|
14
|
+
<img src={Logo} className="w-8 h-8" alt="logo" />
|
|
15
|
+
)}
|
|
16
|
+
{typeof Logo === 'function' && <Logo />}
|
|
16
17
|
<div className="text-xl font-extrabold ml-2 dark:text-white">
|
|
17
18
|
{themeConfig.title}
|
|
18
19
|
</div>
|
|
@@ -1,27 +1,70 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { useThemeContext } from './context';
|
|
3
3
|
import useLanguage from './useLanguage';
|
|
4
4
|
|
|
5
5
|
export default () => {
|
|
6
|
-
const {
|
|
7
|
-
const lang = useLanguage();
|
|
6
|
+
const { themeConfig } = useThemeContext()!;
|
|
8
7
|
return (
|
|
9
8
|
<ul className="flex">
|
|
10
|
-
{themeConfig.navs.map((nav: any) =>
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
{themeConfig.navs.map((nav: any) => (
|
|
10
|
+
<NavItem nav={nav} key={nav.path} />
|
|
11
|
+
))}
|
|
12
|
+
</ul>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
interface NavItemProps {
|
|
17
|
+
nav: {
|
|
18
|
+
path: string;
|
|
19
|
+
title: string;
|
|
20
|
+
dropdown?: {
|
|
21
|
+
title: string;
|
|
22
|
+
path: string;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function NavItem(props: NavItemProps) {
|
|
28
|
+
const { components } = useThemeContext()!;
|
|
29
|
+
const { nav } = props;
|
|
30
|
+
const lang = useLanguage();
|
|
31
|
+
const [isExpanded, setExpanded] = useState(false);
|
|
32
|
+
return (
|
|
33
|
+
<li
|
|
34
|
+
className="ml-8 dark:text-white relative"
|
|
35
|
+
onMouseEnter={() => nav.dropdown && setExpanded(true)}
|
|
36
|
+
onMouseLeave={() => nav.dropdown && setExpanded(false)}
|
|
37
|
+
>
|
|
38
|
+
<components.Link
|
|
39
|
+
to={
|
|
40
|
+
lang.isFromPath ? lang.currentLanguage?.locale + nav.path : nav.path
|
|
41
|
+
}
|
|
42
|
+
>
|
|
43
|
+
{lang.render(nav.title)}
|
|
44
|
+
</components.Link>
|
|
45
|
+
{nav.dropdown && (
|
|
46
|
+
<div
|
|
47
|
+
style={{ maxHeight: isExpanded ? nav.dropdown.length * 48 : 0 }}
|
|
48
|
+
className="absolute transition-all duration-300 w-32 rounded-lg
|
|
49
|
+
cursor-pointer shadow overflow-hidden top-8"
|
|
50
|
+
>
|
|
51
|
+
{nav.dropdown.map((n) => (
|
|
13
52
|
<components.Link
|
|
53
|
+
key={n.path}
|
|
14
54
|
to={
|
|
15
|
-
lang.isFromPath
|
|
16
|
-
? lang.currentLanguage?.locale + nav.path
|
|
17
|
-
: nav.path
|
|
55
|
+
lang.isFromPath ? lang.currentLanguage?.locale + n.path : n.path
|
|
18
56
|
}
|
|
19
57
|
>
|
|
20
|
-
|
|
58
|
+
<p
|
|
59
|
+
className="p-2 bg-white dark:bg-gray-700 dark:text-white
|
|
60
|
+
hover:bg-gray-50 transition duration-300"
|
|
61
|
+
>
|
|
62
|
+
{n.title}
|
|
63
|
+
</p>
|
|
21
64
|
</components.Link>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</
|
|
65
|
+
))}
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
68
|
+
</li>
|
|
26
69
|
);
|
|
27
|
-
}
|
|
70
|
+
}
|
|
@@ -74,7 +74,7 @@ export default () => {
|
|
|
74
74
|
value={keyword}
|
|
75
75
|
onChange={(e) => setKeyword(e.target.value)}
|
|
76
76
|
id="search-input"
|
|
77
|
-
className="w-full bg-transparent outline-none text-sm px-4 py-2
|
|
77
|
+
className="w-full bg-transparent outline-none text-sm px-4 py-2"
|
|
78
78
|
placeholder={render('Search anything ...')}
|
|
79
79
|
/>
|
|
80
80
|
<div
|
|
@@ -28,7 +28,7 @@ export default (props: SidebarProps) => {
|
|
|
28
28
|
<ul
|
|
29
29
|
className={cx(
|
|
30
30
|
'h-screen lg:h-[calc(100vh-8rem)] overflow-y-scroll',
|
|
31
|
-
'lg:w-64
|
|
31
|
+
'lg:w-64 px-8 pt-12 lg:pt-8 pb-36 fadeout w-full',
|
|
32
32
|
)}
|
|
33
33
|
>
|
|
34
34
|
{(matchedNav.children || []).map((item) => {
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import cx from 'classnames';
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { useThemeContext } from './context';
|
|
3
4
|
import MoonIcon from './icons/moon.png';
|
|
4
5
|
import SunIcon from './icons/sun.png';
|
|
5
6
|
|
|
6
7
|
export default () => {
|
|
7
8
|
const [toggle, setToggle] = useState<Boolean>();
|
|
9
|
+
const { themeConfig } = useThemeContext()!;
|
|
8
10
|
|
|
9
11
|
useEffect(() => {
|
|
12
|
+
// If themeConfig disabled the themeSwitch, just set to light theme
|
|
13
|
+
if (!themeConfig.themeSwitch) {
|
|
14
|
+
document.body.classList.remove('dark');
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
// 初始化,获取过去曾经设定过的主题,或是系统当前的主题
|
|
11
19
|
if (toggle === undefined) {
|
|
12
20
|
if (localStorage.getItem('theme') === 'dark') {
|
package/client/theme-doc/Toc.tsx
CHANGED
|
@@ -7,7 +7,7 @@ function getLinkFromTitle(title: string) {
|
|
|
7
7
|
return title
|
|
8
8
|
.toLowerCase()
|
|
9
9
|
.replace(/\s/g, '-')
|
|
10
|
-
.replace(/[()]/g, '');
|
|
10
|
+
.replace(/[()()\\{},]/g, '');
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export default () => {
|
|
@@ -30,7 +30,7 @@ export default () => {
|
|
|
30
30
|
return (
|
|
31
31
|
<div
|
|
32
32
|
className="w-full lg:m-12 mb-12 border
|
|
33
|
-
border-gray-100 p-
|
|
33
|
+
border-gray-100 p-4 rounded-xl z-20"
|
|
34
34
|
>
|
|
35
35
|
{/* @ts-ignore */}
|
|
36
36
|
<Helmet>
|
|
@@ -53,7 +53,7 @@ export default () => {
|
|
|
53
53
|
className={item.level > 2 ? 'text-sm' : ''}
|
|
54
54
|
href={'#' + getLinkFromTitle(item.title)}
|
|
55
55
|
>
|
|
56
|
-
{item.title}
|
|
56
|
+
{item.title.replace(/\\{/g, '{').replace(/\\}/g, '}')}
|
|
57
57
|
</a>
|
|
58
58
|
</li>
|
|
59
59
|
);
|
|
@@ -9,11 +9,14 @@ enum MessageType {
|
|
|
9
9
|
|
|
10
10
|
interface MessageProps {
|
|
11
11
|
type?: MessageType;
|
|
12
|
-
emoji?: string;
|
|
12
|
+
emoji?: string | boolean;
|
|
13
|
+
title?: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
function Message(props: PropsWithChildren<MessageProps>) {
|
|
16
|
-
const messageType = props.type ||
|
|
17
|
+
const messageType = props.type || MessageType.Info;
|
|
18
|
+
const messageTitle = props.title;
|
|
19
|
+
const propsChildren = props.children;
|
|
17
20
|
|
|
18
21
|
let messageClass: string;
|
|
19
22
|
switch (messageType) {
|
|
@@ -30,26 +33,35 @@ function Message(props: PropsWithChildren<MessageProps>) {
|
|
|
30
33
|
messageClass = 'mdx-message-info';
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
let messageEmoji = props.emoji;
|
|
37
|
+
if (!messageEmoji && messageEmoji !== false) {
|
|
38
|
+
switch (messageType) {
|
|
39
|
+
case MessageType.Success:
|
|
40
|
+
messageEmoji = '🏆︎';
|
|
41
|
+
break;
|
|
42
|
+
case MessageType.Warning:
|
|
43
|
+
messageEmoji = '🛎️';
|
|
44
|
+
break;
|
|
45
|
+
case MessageType.Error:
|
|
46
|
+
messageEmoji = '⚠️';
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
messageEmoji = '💡';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
37
52
|
|
|
38
53
|
return (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)}
|
|
49
|
-
{messageText}
|
|
50
|
-
</p>
|
|
54
|
+
<div
|
|
55
|
+
className={`flex w-full py-5 px-4 rounded-lg my-4 mdx-message ${messageClass}`}
|
|
56
|
+
>
|
|
57
|
+
<span role="img" className="mr-3 dark:text-white">
|
|
58
|
+
{messageEmoji}
|
|
59
|
+
</span>
|
|
60
|
+
<div className="flex-grow">
|
|
61
|
+
{messageTitle && <h5 className="mt-0 mb-3">{messageTitle}</h5>}
|
|
62
|
+
<div className="mdx-message-text">{propsChildren}</div>
|
|
51
63
|
</div>
|
|
52
|
-
|
|
64
|
+
</div>
|
|
53
65
|
);
|
|
54
66
|
}
|
|
55
67
|
|
|
@@ -9,21 +9,27 @@ interface IContext {
|
|
|
9
9
|
github: string;
|
|
10
10
|
// 键盘搜索的快捷键,参考 https://github.com/madrobby/keymaster
|
|
11
11
|
searchHotKey?: string | { macos: string; windows: string };
|
|
12
|
-
logo: string;
|
|
12
|
+
logo: string | React.ComponentType;
|
|
13
13
|
// 在设置文件中声明该项目的国际化功能支持的语言
|
|
14
14
|
i18n?: { locale: string; text: string }[];
|
|
15
15
|
// 插件会从 docs/locales 内将所有 json 文件注入到 themeConfig 中
|
|
16
16
|
// 供 useLanguage 使用
|
|
17
17
|
locales: { [locale: string]: { [key: string]: string } };
|
|
18
|
+
// 顶部导航栏右侧自定义组件
|
|
19
|
+
extraNavRight?: React.ComponentType;
|
|
20
|
+
// 底部导航栏左侧自定义组件
|
|
21
|
+
extraNavLeft?: React.ComponentType;
|
|
18
22
|
navs: {
|
|
19
23
|
path: string;
|
|
20
24
|
title: string;
|
|
25
|
+
dropdown?: { title: string; path: string }[];
|
|
21
26
|
children: any[];
|
|
22
27
|
}[];
|
|
23
28
|
announcement?: {
|
|
24
29
|
title: string;
|
|
25
30
|
link?: string;
|
|
26
31
|
};
|
|
32
|
+
themeSwitch?: {};
|
|
27
33
|
};
|
|
28
34
|
location: {
|
|
29
35
|
pathname: string;
|
|
@@ -36,7 +36,7 @@ article ul {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
article li {
|
|
39
|
-
@apply mt-2 dark:text-white;
|
|
39
|
+
@apply text-base mt-2 leading-7 text-gray-700 dark:text-white;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
article ol {
|
|
@@ -51,63 +51,127 @@ article h2 a {
|
|
|
51
51
|
@apply no-underline dark:text-white;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/* 行内代码 */
|
|
54
55
|
article code {
|
|
55
|
-
@apply bg-
|
|
56
|
+
@apply text-sky-600 dark:text-sky-300 bg-slate-800 bg-opacity-5 dark:bg-opacity-100 border border-black border-opacity-5 rounded-md;
|
|
56
57
|
font-size: 0.9em;
|
|
57
58
|
padding: 2px 0.25em;
|
|
58
59
|
box-decoration-break: clone;
|
|
59
60
|
font-feature-settings: 'rlig' 1, 'calt' 1, 'ss01' 1;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
/* 行内高亮代码 */
|
|
64
|
+
article span[data-rehype-pretty-code-fragment] code {
|
|
65
|
+
@apply bg-zinc-900 dark:bg-zinc-900;
|
|
64
66
|
}
|
|
65
67
|
|
|
68
|
+
/* 代码块 */
|
|
66
69
|
article pre {
|
|
67
|
-
/* content-visibility: auto; */
|
|
68
70
|
contain: paint;
|
|
69
|
-
@apply
|
|
71
|
+
@apply my-4 bg-zinc-900 dark:bg-zinc-900 text-neutral-300 dark:text-neutral-300 rounded-md font-medium subpixel-antialiased transition;
|
|
72
|
+
}
|
|
73
|
+
article pre > code {
|
|
74
|
+
@apply grid leading-relaxed p-4 text-sm text-neutral-300 dark:text-neutral-300 bg-transparent dark:bg-transparent rounded-none border-none min-w-full overflow-x-auto;
|
|
75
|
+
}
|
|
76
|
+
article div[data-rehype-pretty-code-fragment] {
|
|
77
|
+
@apply my-4;
|
|
70
78
|
}
|
|
71
79
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
@apply
|
|
80
|
+
/* 代码块的标题部分 */
|
|
81
|
+
article div[data-rehype-pretty-code-fragment] > div[data-rehype-pretty-code-title] {
|
|
82
|
+
@apply pb-1 text-sm text-zinc-400 dark:text-neutral-400 text-center;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* 代码块的代码部分 */
|
|
86
|
+
article div[data-rehype-pretty-code-fragment] > pre {
|
|
87
|
+
@apply pt-6 my-0;
|
|
88
|
+
}
|
|
89
|
+
article div[data-rehype-pretty-code-fragment] > pre > code {
|
|
90
|
+
@apply my-0 pt-0 px-0;
|
|
75
91
|
}
|
|
76
92
|
|
|
77
|
-
|
|
78
|
-
|
|
93
|
+
/* 代码块的使用语言 */
|
|
94
|
+
article div[data-rehype-pretty-code-fragment] > pre::before {
|
|
95
|
+
@apply fixed top-0 right-0 px-2 text-sm uppercase bg-neutral-300 text-zinc-900 bg-opacity-80 dark:bg-opacity-60 rounded-sm;
|
|
96
|
+
content: attr(data-language);
|
|
79
97
|
}
|
|
80
98
|
|
|
81
|
-
|
|
82
|
-
|
|
99
|
+
/* 代码块的代码行 */
|
|
100
|
+
article div[data-rehype-pretty-code-fragment] > pre > code .line {
|
|
101
|
+
@apply pl-3 pr-4;
|
|
83
102
|
}
|
|
84
103
|
|
|
104
|
+
/* 代码块的行内高亮文字 */
|
|
105
|
+
article div[data-rehype-pretty-code-fragment] > pre > code .line .word {
|
|
106
|
+
@apply px-1.5 inline-block bg-neutral-300 bg-opacity-20 rounded-sm;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* 代码块的行号 */
|
|
110
|
+
article div[data-rehype-pretty-code-fragment] > pre > code {
|
|
111
|
+
counter-reset: line;
|
|
112
|
+
}
|
|
113
|
+
article div[data-rehype-pretty-code-fragment] > pre > code > .line::before {
|
|
114
|
+
@apply text-neutral-600 w-4 mr-4 inline-block text-right;
|
|
115
|
+
counter-increment: line;
|
|
116
|
+
content: counter(line);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* 代码块的高亮行 */
|
|
120
|
+
article div[data-rehype-pretty-code-fragment] pre > code > .line {
|
|
121
|
+
@apply border-l-2 border-transparent;
|
|
122
|
+
}
|
|
123
|
+
article div[data-rehype-pretty-code-fragment] pre > code > .line.highlighted {
|
|
124
|
+
@apply bg-neutral-100 dark:bg-neutral-300 bg-opacity-10 dark:bg-opacity-10 border-l-blue-400 dark:border-l-sky-600;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* 链接 */
|
|
85
128
|
article a {
|
|
86
|
-
@apply text-
|
|
129
|
+
@apply mx-1 text-cyan-600 dark:text-fuchsia-200 hover:text-cyan-900 dark:hover:text-fuchsia-400 transition;
|
|
130
|
+
background-image: linear-gradient(
|
|
131
|
+
transparent 60%,
|
|
132
|
+
rgba(130, 199, 255, 0.28) 55%
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
.dark article a {
|
|
136
|
+
background-image: linear-gradient(
|
|
137
|
+
transparent 60%,
|
|
138
|
+
rgba(238, 157, 234, 0.28) 55%
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* 行内代码块链接 */
|
|
143
|
+
article a > code {
|
|
144
|
+
@apply text-cyan-600 dark:text-fuchsia-200 hover:text-cyan-900 dark:hover:text-fuchsia-400 transition;
|
|
87
145
|
background-image: linear-gradient(
|
|
88
146
|
transparent 60%,
|
|
89
147
|
rgba(130, 199, 255, 0.28) 55%
|
|
90
148
|
);
|
|
91
149
|
}
|
|
150
|
+
.dark article a > code {
|
|
151
|
+
background-image: linear-gradient(
|
|
152
|
+
transparent 60%,
|
|
153
|
+
rgba(238, 157, 234, 0.28) 55%
|
|
154
|
+
);
|
|
155
|
+
}
|
|
92
156
|
|
|
93
157
|
article table {
|
|
94
|
-
@apply table-auto w-full shadow rounded-xl text-left overflow-hidden dark:shadow-gray-800 my-8
|
|
158
|
+
@apply table-auto w-full shadow rounded-xl text-left overflow-hidden dark:shadow-gray-800 my-8;
|
|
95
159
|
}
|
|
96
160
|
|
|
97
161
|
article table thead {
|
|
98
|
-
@apply bg-blue-100 dark:bg-gray-800
|
|
162
|
+
@apply bg-blue-100 dark:bg-gray-800;
|
|
99
163
|
}
|
|
100
164
|
|
|
101
165
|
article table thead th {
|
|
102
|
-
@apply py-3 px-4 text-gray-700 dark:text-white
|
|
166
|
+
@apply py-3 px-4 text-gray-700 dark:text-white;
|
|
103
167
|
}
|
|
104
168
|
|
|
105
169
|
article table tbody tr {
|
|
106
|
-
@apply border-b border-b-zinc-100 dark:border-b-gray-600
|
|
170
|
+
@apply border-b border-b-zinc-100 dark:border-b-gray-600;
|
|
107
171
|
}
|
|
108
172
|
|
|
109
173
|
article table tbody td {
|
|
110
|
-
@apply py-2 px-4 text-gray-700 dark:text-white
|
|
174
|
+
@apply py-2 px-4 text-gray-700 dark:text-white;
|
|
111
175
|
}
|
|
112
176
|
|
|
113
177
|
.link-with-underline {
|
|
@@ -181,39 +245,51 @@ h6 {
|
|
|
181
245
|
@apply border-l-8;
|
|
182
246
|
}
|
|
183
247
|
|
|
184
|
-
.mdx-message
|
|
248
|
+
.mdx-message code {
|
|
249
|
+
@apply dark:bg-opacity-50;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.mdx-message-text :first-child {
|
|
185
253
|
@apply mt-0;
|
|
186
254
|
}
|
|
187
255
|
|
|
256
|
+
.mdx-message-text img {
|
|
257
|
+
@apply rounded-md;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.mdx-message-text pre {
|
|
261
|
+
@apply my-2;
|
|
262
|
+
}
|
|
263
|
+
|
|
188
264
|
.mdx-message-info {
|
|
189
|
-
@apply bg-blue-50 border-blue-300 dark:bg-blue-
|
|
265
|
+
@apply bg-blue-50 border-blue-300 dark:bg-blue-900 dark:border-blue-500;
|
|
190
266
|
}
|
|
191
267
|
|
|
192
|
-
.mdx-message-info
|
|
193
|
-
@apply text-blue-
|
|
268
|
+
.mdx-message-info code {
|
|
269
|
+
@apply text-blue-800 dark:text-blue-200;
|
|
194
270
|
}
|
|
195
271
|
|
|
196
272
|
.mdx-message-success {
|
|
197
|
-
@apply bg-green-50 border-green-300 dark:bg-green-
|
|
273
|
+
@apply bg-green-50 border-green-300 dark:bg-green-700 dark:border-green-500;
|
|
198
274
|
}
|
|
199
275
|
|
|
200
|
-
.mdx-message-success
|
|
201
|
-
@apply text-green-
|
|
276
|
+
.mdx-message-success code {
|
|
277
|
+
@apply text-green-800 dark:text-green-200;
|
|
202
278
|
}
|
|
203
279
|
|
|
204
280
|
.mdx-message-warning {
|
|
205
|
-
@apply bg-orange-50 border-orange-300 dark:bg-orange-
|
|
281
|
+
@apply bg-orange-50 border-orange-300 dark:bg-orange-700 dark:border-orange-500;
|
|
206
282
|
}
|
|
207
283
|
|
|
208
|
-
.mdx-message-warning
|
|
209
|
-
@apply text-orange-
|
|
284
|
+
.mdx-message-warning code {
|
|
285
|
+
@apply text-orange-700 dark:text-orange-100;
|
|
210
286
|
}
|
|
211
287
|
|
|
212
288
|
.mdx-message-error {
|
|
213
|
-
@apply bg-red-50 border-red-300 dark:bg-
|
|
289
|
+
@apply bg-red-50 border-red-300 dark:bg-rose-700 dark:border-rose-500;
|
|
214
290
|
}
|
|
215
291
|
|
|
216
|
-
.mdx-message-error
|
|
217
|
-
@apply text-red-
|
|
292
|
+
.mdx-message-error code {
|
|
293
|
+
@apply text-red-700 dark:text-rose-100;
|
|
218
294
|
}
|
|
219
295
|
}
|