@umijs/plugin-docs 4.0.4 → 4.0.7
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/Search.tsx +16 -1
- package/client/theme-doc/components/Tabbed.tsx +78 -0
- package/client/theme-doc/index.ts +1 -0
- package/client/theme-doc/tailwind.css +50 -6
- package/client/theme-doc/tailwind.out.css +256 -0
- package/compiled/rehype-autolink-headings/LICENSE +22 -0
- package/compiled/rehype-autolink-headings/index.js +1 -0
- package/compiled/rehype-autolink-headings/package.json +1 -0
- package/dist/compiler.js +7 -1
- package/package.json +8 -5
|
@@ -112,7 +112,7 @@ export default () => {
|
|
|
112
112
|
<components.Link
|
|
113
113
|
to={(isFromPath ? currentLanguage?.locale : '') + r.href}
|
|
114
114
|
key={i}
|
|
115
|
-
onClick={() => (
|
|
115
|
+
onClick={() => scrollToAnchor(r.href)}
|
|
116
116
|
className="group outline-none search-result"
|
|
117
117
|
onFocus={() => setIsFocused(true)}
|
|
118
118
|
onBlur={() => setIsFocused(false)}
|
|
@@ -206,3 +206,18 @@ function handleKeyUp(e: KeyboardEvent) {
|
|
|
206
206
|
document.activeElement?.previousSibling as HTMLDivElement | undefined
|
|
207
207
|
)?.focus();
|
|
208
208
|
}
|
|
209
|
+
|
|
210
|
+
function scrollToAnchor(to: string) {
|
|
211
|
+
const hash = to.match(/(#[^&?]*)/)?.[1] || '';
|
|
212
|
+
|
|
213
|
+
(document.activeElement as HTMLElement)?.blur();
|
|
214
|
+
|
|
215
|
+
window.requestAnimationFrame(() => {
|
|
216
|
+
const elm = document.getElementById(hash.substring(1));
|
|
217
|
+
if (elm) {
|
|
218
|
+
elm.scrollIntoView();
|
|
219
|
+
} else {
|
|
220
|
+
window.scrollTo(0, 0);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { FC, PropsWithChildren, ReactNode, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
type Pane = {
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type TabbedProps = {
|
|
9
|
+
panes?: Pane[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default function Tabbed(props: PropsWithChildren<TabbedProps>) {
|
|
13
|
+
const { children } = props;
|
|
14
|
+
|
|
15
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
16
|
+
|
|
17
|
+
let tabs: ReactNode[] = [];
|
|
18
|
+
let content: ReactNode = null;
|
|
19
|
+
|
|
20
|
+
if (props.panes && props.panes.length > 0) {
|
|
21
|
+
tabs = props.panes.map((pane) => {
|
|
22
|
+
return pane.title;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
content = props.panes[activeTab].content;
|
|
26
|
+
} else {
|
|
27
|
+
// Guess pane from children, make mdx more idiomatic
|
|
28
|
+
const childrenArray = React.Children.toArray(children) || [];
|
|
29
|
+
|
|
30
|
+
tabs = childrenArray.filter((_, index) => index % 2 === 0);
|
|
31
|
+
const contents = childrenArray.filter((_, index) => index % 2 === 1);
|
|
32
|
+
|
|
33
|
+
content = contents[activeTab];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className="tabbed-code">
|
|
38
|
+
<Wrapper>
|
|
39
|
+
<Tabs tabs={tabs} setActiveTab={setActiveTab} activeTab={activeTab} />
|
|
40
|
+
</Wrapper>
|
|
41
|
+
{content || null}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
const Wrapper: FC<PropsWithChildren> = ({ children }) => {
|
|
46
|
+
return <div className={`w-full pt-5 pt-0 `}>{children}</div>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const Tabs: FC<
|
|
50
|
+
PropsWithChildren<{
|
|
51
|
+
tabs: ReactNode[];
|
|
52
|
+
setActiveTab: Function;
|
|
53
|
+
activeTab: number;
|
|
54
|
+
}>
|
|
55
|
+
> = ({ tabs, activeTab, setActiveTab }) => {
|
|
56
|
+
return (
|
|
57
|
+
<ul className="cursor-pointer m-0 mt-4 px-0 list-none inline-flex flex-wrap rounded-t-lg text-sm font-small text-center text-gray-500 dark:text-gray-400">
|
|
58
|
+
{tabs.map((tab, index) => {
|
|
59
|
+
return (
|
|
60
|
+
<li key={index} className="mr-0 mt-0">
|
|
61
|
+
<button
|
|
62
|
+
onClick={() => setActiveTab(index)}
|
|
63
|
+
className={`tabbed-tab-button
|
|
64
|
+
hover:text-gray-700 hover:border-gray-300 dark:hover:text-gray-300
|
|
65
|
+
${
|
|
66
|
+
activeTab === index
|
|
67
|
+
? 'bg-zinc-900 text-white hover:text-neutral-300 dark:text-white'
|
|
68
|
+
: 'text-neutral-500 hover:text-gray-700 hover:border-gray-300 dark:hover:text-gray-300 '
|
|
69
|
+
}`}
|
|
70
|
+
>
|
|
71
|
+
{tab}
|
|
72
|
+
</button>
|
|
73
|
+
</li>
|
|
74
|
+
);
|
|
75
|
+
})}
|
|
76
|
+
</ul>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
@@ -5,4 +5,5 @@ export { default as FeatureItem } from './components/FeatureItem';
|
|
|
5
5
|
export { default as Features } from './components/Features';
|
|
6
6
|
export { default as Hero } from './components/Hero';
|
|
7
7
|
export { default as Message } from './components/Message';
|
|
8
|
+
export { default as Tabbed } from './components/Tabbed';
|
|
8
9
|
export { default as $Layout } from './Layout';
|
|
@@ -3,28 +3,28 @@
|
|
|
3
3
|
@tailwind utilities;
|
|
4
4
|
|
|
5
5
|
article h1 {
|
|
6
|
-
@apply text-4xl font-bold tracking-tight mt-2 my-4 dark:text-white;
|
|
6
|
+
@apply text-4xl font-bold tracking-tight mt-2 my-4 dark:text-white title-link;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
article h2 {
|
|
10
|
-
@apply text-3xl font-semibold tracking-tight mt-10 dark:text-white;
|
|
10
|
+
@apply text-3xl font-semibold tracking-tight mt-10 dark:text-white title-link;
|
|
11
11
|
@apply pb-1 border-b;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
article h3 {
|
|
15
|
-
@apply text-2xl font-semibold tracking-tight mt-8 dark:text-white;
|
|
15
|
+
@apply text-2xl font-semibold tracking-tight mt-8 dark:text-white title-link;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
article h4 {
|
|
19
|
-
@apply text-xl font-semibold tracking-tight mt-8 dark:text-white;
|
|
19
|
+
@apply text-xl font-semibold tracking-tight mt-8 dark:text-white title-link;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
article h5 {
|
|
23
|
-
@apply text-lg font-semibold tracking-tight mt-8 dark:text-white;
|
|
23
|
+
@apply text-lg font-semibold tracking-tight mt-8 dark:text-white title-link;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
article h6 {
|
|
27
|
-
@apply text-base font-semibold tracking-tight mt-8 dark:text-white;
|
|
27
|
+
@apply text-base font-semibold tracking-tight mt-8 dark:text-white title-link;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
article p {
|
|
@@ -77,6 +77,23 @@ article div[data-rehype-pretty-code-fragment] {
|
|
|
77
77
|
@apply my-4;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
article .tabbed-code div[data-rehype-pretty-code-fragment] {
|
|
81
|
+
@apply my-0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
article .tabbed-code pre {
|
|
85
|
+
@apply rounded-none rounded-b-md rounded-tr-md;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
article .tabbed-code .tabbed-tab-button {
|
|
89
|
+
@apply inline-flex items-center rounded-t-lg px-4;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
article .tabbed-code .tabbed-tab-button * {
|
|
93
|
+
@apply mt-0;
|
|
94
|
+
color: inherit;
|
|
95
|
+
}
|
|
96
|
+
|
|
80
97
|
/* 代码块的标题部分 */
|
|
81
98
|
article
|
|
82
99
|
div[data-rehype-pretty-code-fragment]
|
|
@@ -223,6 +240,33 @@ h6 {
|
|
|
223
240
|
}
|
|
224
241
|
|
|
225
242
|
@layer components {
|
|
243
|
+
.title-link a {
|
|
244
|
+
float: left;
|
|
245
|
+
margin-top: 0.1em;
|
|
246
|
+
margin-left: -24px;
|
|
247
|
+
width: 20px;
|
|
248
|
+
padding-right: 4px;
|
|
249
|
+
line-height: 1;
|
|
250
|
+
box-sizing: border-box;
|
|
251
|
+
background: none;
|
|
252
|
+
opacity: 0;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.title-link:hover a {
|
|
256
|
+
opacity: 1;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.title-link span {
|
|
260
|
+
display: none;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.title-link a::after {
|
|
264
|
+
content: '#';
|
|
265
|
+
display: inline-block;
|
|
266
|
+
vertical-align: middle;
|
|
267
|
+
font-size: 20px;
|
|
268
|
+
}
|
|
269
|
+
|
|
226
270
|
.features-dark {
|
|
227
271
|
@apply bg-gray-900;
|
|
228
272
|
background-image: radial-gradient(#2a2a2a 20%, transparent 20%);
|
|
@@ -787,6 +787,10 @@ video {
|
|
|
787
787
|
margin: 2rem;
|
|
788
788
|
}
|
|
789
789
|
|
|
790
|
+
.m-0 {
|
|
791
|
+
margin: 0px;
|
|
792
|
+
}
|
|
793
|
+
|
|
790
794
|
.my-6 {
|
|
791
795
|
margin-top: 1.5rem;
|
|
792
796
|
margin-bottom: 1.5rem;
|
|
@@ -873,6 +877,10 @@ video {
|
|
|
873
877
|
margin-bottom: 0.75rem;
|
|
874
878
|
}
|
|
875
879
|
|
|
880
|
+
.mr-0 {
|
|
881
|
+
margin-right: 0px;
|
|
882
|
+
}
|
|
883
|
+
|
|
876
884
|
.block {
|
|
877
885
|
display: block;
|
|
878
886
|
}
|
|
@@ -881,6 +889,14 @@ video {
|
|
|
881
889
|
display: flex;
|
|
882
890
|
}
|
|
883
891
|
|
|
892
|
+
.inline-flex {
|
|
893
|
+
display: inline-flex;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
.contents {
|
|
897
|
+
display: contents;
|
|
898
|
+
}
|
|
899
|
+
|
|
884
900
|
.hidden {
|
|
885
901
|
display: none;
|
|
886
902
|
}
|
|
@@ -1088,6 +1104,10 @@ video {
|
|
|
1088
1104
|
cursor: default;
|
|
1089
1105
|
}
|
|
1090
1106
|
|
|
1107
|
+
.list-none {
|
|
1108
|
+
list-style-type: none;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1091
1111
|
.flex-row {
|
|
1092
1112
|
flex-direction: row;
|
|
1093
1113
|
}
|
|
@@ -1156,6 +1176,11 @@ video {
|
|
|
1156
1176
|
border-radius: 0.75rem;
|
|
1157
1177
|
}
|
|
1158
1178
|
|
|
1179
|
+
.rounded-t-lg {
|
|
1180
|
+
border-top-left-radius: 0.5rem;
|
|
1181
|
+
border-top-right-radius: 0.5rem;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1159
1184
|
.border {
|
|
1160
1185
|
border-width: 1px;
|
|
1161
1186
|
}
|
|
@@ -1236,6 +1261,11 @@ video {
|
|
|
1236
1261
|
background-color: rgb(37 99 235 / var(--tw-bg-opacity));
|
|
1237
1262
|
}
|
|
1238
1263
|
|
|
1264
|
+
.bg-zinc-900 {
|
|
1265
|
+
--tw-bg-opacity: 1;
|
|
1266
|
+
background-color: rgb(24 24 27 / var(--tw-bg-opacity));
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1239
1269
|
.object-cover {
|
|
1240
1270
|
-o-object-fit: cover;
|
|
1241
1271
|
object-fit: cover;
|
|
@@ -1309,6 +1339,11 @@ video {
|
|
|
1309
1339
|
padding-bottom: 1.25rem;
|
|
1310
1340
|
}
|
|
1311
1341
|
|
|
1342
|
+
.px-0 {
|
|
1343
|
+
padding-left: 0px;
|
|
1344
|
+
padding-right: 0px;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1312
1347
|
.pt-4 {
|
|
1313
1348
|
padding-top: 1rem;
|
|
1314
1349
|
}
|
|
@@ -1341,6 +1376,14 @@ video {
|
|
|
1341
1376
|
padding-bottom: 3rem;
|
|
1342
1377
|
}
|
|
1343
1378
|
|
|
1379
|
+
.pt-5 {
|
|
1380
|
+
padding-top: 1.25rem;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
.pt-0 {
|
|
1384
|
+
padding-top: 0px;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1344
1387
|
.text-center {
|
|
1345
1388
|
text-align: center;
|
|
1346
1389
|
}
|
|
@@ -1438,6 +1481,11 @@ video {
|
|
|
1438
1481
|
color: rgb(147 197 253 / var(--tw-text-opacity));
|
|
1439
1482
|
}
|
|
1440
1483
|
|
|
1484
|
+
.text-neutral-500 {
|
|
1485
|
+
--tw-text-opacity: 1;
|
|
1486
|
+
color: rgb(115 115 115 / var(--tw-text-opacity));
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1441
1489
|
.opacity-0 {
|
|
1442
1490
|
opacity: 0;
|
|
1443
1491
|
}
|
|
@@ -1543,6 +1591,33 @@ video {
|
|
|
1543
1591
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
1544
1592
|
}
|
|
1545
1593
|
|
|
1594
|
+
article h1 a {
|
|
1595
|
+
float: left;
|
|
1596
|
+
margin-top: 0.1em;
|
|
1597
|
+
margin-left: -24px;
|
|
1598
|
+
width: 20px;
|
|
1599
|
+
padding-right: 4px;
|
|
1600
|
+
line-height: 1;
|
|
1601
|
+
box-sizing: border-box;
|
|
1602
|
+
background: none;
|
|
1603
|
+
opacity: 0;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
article h1:hover a {
|
|
1607
|
+
opacity: 1;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
article h1 span {
|
|
1611
|
+
display: none;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
article h1 a::after {
|
|
1615
|
+
content: '#';
|
|
1616
|
+
display: inline-block;
|
|
1617
|
+
vertical-align: middle;
|
|
1618
|
+
font-size: 20px;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1546
1621
|
article h1 {
|
|
1547
1622
|
margin-bottom: 1rem;
|
|
1548
1623
|
margin-top: 0.5rem;
|
|
@@ -1557,6 +1632,33 @@ article h1 {
|
|
|
1557
1632
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1558
1633
|
}
|
|
1559
1634
|
|
|
1635
|
+
article h2 a {
|
|
1636
|
+
float: left;
|
|
1637
|
+
margin-top: 0.1em;
|
|
1638
|
+
margin-left: -24px;
|
|
1639
|
+
width: 20px;
|
|
1640
|
+
padding-right: 4px;
|
|
1641
|
+
line-height: 1;
|
|
1642
|
+
box-sizing: border-box;
|
|
1643
|
+
background: none;
|
|
1644
|
+
opacity: 0;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
article h2:hover a {
|
|
1648
|
+
opacity: 1;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
article h2 span {
|
|
1652
|
+
display: none;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
article h2 a::after {
|
|
1656
|
+
content: '#';
|
|
1657
|
+
display: inline-block;
|
|
1658
|
+
vertical-align: middle;
|
|
1659
|
+
font-size: 20px;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1560
1662
|
article h2 {
|
|
1561
1663
|
margin-top: 2.5rem;
|
|
1562
1664
|
font-size: 1.875rem;
|
|
@@ -1575,6 +1677,33 @@ article h2 {
|
|
|
1575
1677
|
padding-bottom: 0.25rem;
|
|
1576
1678
|
}
|
|
1577
1679
|
|
|
1680
|
+
article h3 a {
|
|
1681
|
+
float: left;
|
|
1682
|
+
margin-top: 0.1em;
|
|
1683
|
+
margin-left: -24px;
|
|
1684
|
+
width: 20px;
|
|
1685
|
+
padding-right: 4px;
|
|
1686
|
+
line-height: 1;
|
|
1687
|
+
box-sizing: border-box;
|
|
1688
|
+
background: none;
|
|
1689
|
+
opacity: 0;
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
article h3:hover a {
|
|
1693
|
+
opacity: 1;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
article h3 span {
|
|
1697
|
+
display: none;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
article h3 a::after {
|
|
1701
|
+
content: '#';
|
|
1702
|
+
display: inline-block;
|
|
1703
|
+
vertical-align: middle;
|
|
1704
|
+
font-size: 20px;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1578
1707
|
article h3 {
|
|
1579
1708
|
margin-top: 2rem;
|
|
1580
1709
|
font-size: 1.5rem;
|
|
@@ -1588,6 +1717,33 @@ article h3 {
|
|
|
1588
1717
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1589
1718
|
}
|
|
1590
1719
|
|
|
1720
|
+
article h4 a {
|
|
1721
|
+
float: left;
|
|
1722
|
+
margin-top: 0.1em;
|
|
1723
|
+
margin-left: -24px;
|
|
1724
|
+
width: 20px;
|
|
1725
|
+
padding-right: 4px;
|
|
1726
|
+
line-height: 1;
|
|
1727
|
+
box-sizing: border-box;
|
|
1728
|
+
background: none;
|
|
1729
|
+
opacity: 0;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
article h4:hover a {
|
|
1733
|
+
opacity: 1;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
article h4 span {
|
|
1737
|
+
display: none;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
article h4 a::after {
|
|
1741
|
+
content: '#';
|
|
1742
|
+
display: inline-block;
|
|
1743
|
+
vertical-align: middle;
|
|
1744
|
+
font-size: 20px;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1591
1747
|
article h4 {
|
|
1592
1748
|
margin-top: 2rem;
|
|
1593
1749
|
font-size: 1.25rem;
|
|
@@ -1601,6 +1757,33 @@ article h4 {
|
|
|
1601
1757
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1602
1758
|
}
|
|
1603
1759
|
|
|
1760
|
+
article h5 a {
|
|
1761
|
+
float: left;
|
|
1762
|
+
margin-top: 0.1em;
|
|
1763
|
+
margin-left: -24px;
|
|
1764
|
+
width: 20px;
|
|
1765
|
+
padding-right: 4px;
|
|
1766
|
+
line-height: 1;
|
|
1767
|
+
box-sizing: border-box;
|
|
1768
|
+
background: none;
|
|
1769
|
+
opacity: 0;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
article h5:hover a {
|
|
1773
|
+
opacity: 1;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
article h5 span {
|
|
1777
|
+
display: none;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
article h5 a::after {
|
|
1781
|
+
content: '#';
|
|
1782
|
+
display: inline-block;
|
|
1783
|
+
vertical-align: middle;
|
|
1784
|
+
font-size: 20px;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1604
1787
|
article h5 {
|
|
1605
1788
|
margin-top: 2rem;
|
|
1606
1789
|
font-size: 1.125rem;
|
|
@@ -1614,6 +1797,33 @@ article h5 {
|
|
|
1614
1797
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1615
1798
|
}
|
|
1616
1799
|
|
|
1800
|
+
article h6 a {
|
|
1801
|
+
float: left;
|
|
1802
|
+
margin-top: 0.1em;
|
|
1803
|
+
margin-left: -24px;
|
|
1804
|
+
width: 20px;
|
|
1805
|
+
padding-right: 4px;
|
|
1806
|
+
line-height: 1;
|
|
1807
|
+
box-sizing: border-box;
|
|
1808
|
+
background: none;
|
|
1809
|
+
opacity: 0;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
article h6:hover a {
|
|
1813
|
+
opacity: 1;
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
article h6 span {
|
|
1817
|
+
display: none;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
article h6 a::after {
|
|
1821
|
+
content: '#';
|
|
1822
|
+
display: inline-block;
|
|
1823
|
+
vertical-align: middle;
|
|
1824
|
+
font-size: 20px;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1617
1827
|
article h6 {
|
|
1618
1828
|
margin-top: 2rem;
|
|
1619
1829
|
font-size: 1rem;
|
|
@@ -1793,6 +2003,32 @@ article div[data-rehype-pretty-code-fragment] {
|
|
|
1793
2003
|
margin-bottom: 1rem;
|
|
1794
2004
|
}
|
|
1795
2005
|
|
|
2006
|
+
article .tabbed-code div[data-rehype-pretty-code-fragment] {
|
|
2007
|
+
margin-top: 0px;
|
|
2008
|
+
margin-bottom: 0px;
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
article .tabbed-code pre {
|
|
2012
|
+
border-radius: 0px;
|
|
2013
|
+
border-bottom-right-radius: 0.375rem;
|
|
2014
|
+
border-bottom-left-radius: 0.375rem;
|
|
2015
|
+
border-top-right-radius: 0.375rem;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
article .tabbed-code .tabbed-tab-button {
|
|
2019
|
+
display: inline-flex;
|
|
2020
|
+
align-items: center;
|
|
2021
|
+
border-top-left-radius: 0.5rem;
|
|
2022
|
+
border-top-right-radius: 0.5rem;
|
|
2023
|
+
padding-left: 1rem;
|
|
2024
|
+
padding-right: 1rem;
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
article .tabbed-code .tabbed-tab-button * {
|
|
2028
|
+
margin-top: 0px;
|
|
2029
|
+
color: inherit;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
1796
2032
|
/* 代码块的标题部分 */
|
|
1797
2033
|
|
|
1798
2034
|
article
|
|
@@ -2203,6 +2439,11 @@ h6 {
|
|
|
2203
2439
|
border-color: rgb(243 244 246 / var(--tw-border-opacity));
|
|
2204
2440
|
}
|
|
2205
2441
|
|
|
2442
|
+
.hover\:border-gray-300:hover {
|
|
2443
|
+
--tw-border-opacity: 1;
|
|
2444
|
+
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2206
2447
|
.hover\:bg-gray-50:hover {
|
|
2207
2448
|
--tw-bg-opacity: 1;
|
|
2208
2449
|
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
|
|
@@ -2218,6 +2459,16 @@ h6 {
|
|
|
2218
2459
|
color: rgb(59 130 246 / var(--tw-text-opacity));
|
|
2219
2460
|
}
|
|
2220
2461
|
|
|
2462
|
+
.hover\:text-gray-700:hover {
|
|
2463
|
+
--tw-text-opacity: 1;
|
|
2464
|
+
color: rgb(55 65 81 / var(--tw-text-opacity));
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
.hover\:text-neutral-300:hover {
|
|
2468
|
+
--tw-text-opacity: 1;
|
|
2469
|
+
color: rgb(212 212 212 / var(--tw-text-opacity));
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2221
2472
|
.hover\:shadow-2xl:hover {
|
|
2222
2473
|
--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
|
|
2223
2474
|
--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);
|
|
@@ -2375,6 +2626,11 @@ h6 {
|
|
|
2375
2626
|
color: rgb(59 130 246 / var(--tw-text-opacity));
|
|
2376
2627
|
}
|
|
2377
2628
|
|
|
2629
|
+
.dark .dark\:hover\:text-gray-300:hover {
|
|
2630
|
+
--tw-text-opacity: 1;
|
|
2631
|
+
color: rgb(209 213 219 / var(--tw-text-opacity));
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2378
2634
|
@media (min-width: 768px) {
|
|
2379
2635
|
.md\:h-6 {
|
|
2380
2636
|
height: 1.5rem;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){"use strict";var e={980:function(e){var t=Object.prototype.hasOwnProperty;var n=Object.prototype.toString;var r=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var i=function isArray(e){if(typeof Array.isArray==="function"){return Array.isArray(e)}return n.call(e)==="[object Array]"};var u=function isPlainObject(e){if(!e||n.call(e)!=="[object Object]"){return false}var r=t.call(e,"constructor");var o=e.constructor&&e.constructor.prototype&&t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!r&&!o){return false}var i;for(i in e){}return typeof i==="undefined"||t.call(e,i)};var a=function setProperty(e,t){if(r&&t.name==="__proto__"){r(e,t.name,{enumerable:true,configurable:true,value:t.newValue,writable:true})}else{e[t.name]=t.newValue}};var c=function getProperty(e,n){if(n==="__proto__"){if(!t.call(e,n)){return void 0}else if(o){return o(e,n).value}}return e[n]};e.exports=function extend(){var e,t,n,r,o,f;var l=arguments[0];var s=1;var p=arguments.length;var y=false;if(typeof l==="boolean"){y=l;l=arguments[1]||{};s=2}if(l==null||typeof l!=="object"&&typeof l!=="function"){l={}}for(;s<p;++s){e=arguments[s];if(e!=null){for(t in e){n=c(l,t);r=c(e,t);if(l!==r){if(y&&r&&(u(r)||(o=i(r)))){if(o){o=false;f=n&&i(n)?n:[]}else{f=n&&u(n)?n:{}}a(l,{name:t,newValue:extend(y,f,r)})}else if(typeof r!=="undefined"){a(l,{name:t,newValue:r})}}}}}return l}}};var t={};function __nccwpck_require__(n){var r=t[n];if(r!==undefined){return r.exports}var o=t[n]={exports:{}};var i=true;try{e[n](o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete t[n]}return o.exports}!function(){__nccwpck_require__.d=function(e,t){for(var n in t){if(__nccwpck_require__.o(t,n)&&!__nccwpck_require__.o(e,n)){Object.defineProperty(e,n,{enumerable:true,get:t[n]})}}}}();!function(){__nccwpck_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}();!function(){__nccwpck_require__.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}}();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n={};!function(){__nccwpck_require__.r(n);__nccwpck_require__.d(n,{default:function(){return rehypeAutolinkHeadings}});var e=__nccwpck_require__(980);var t={}.hasOwnProperty;function hasProperty(e,n){var r=n&&e&&typeof e==="object"&&e.type==="element"&&e.properties&&t.call(e.properties,n)&&e.properties[n];return r!==null&&r!==undefined&&r!==false}function headingRank(e){var t=e&&e.type==="element"&&e.tagName.toLowerCase()||"";var n=t.length===2&&t.charCodeAt(0)===104?t.charCodeAt(1):0;return n>48&&n<55?n-48:null}const isElement=function(e,t,n,r,o){const i=convertElement(t);if(n!==undefined&&n!==null&&(typeof n!=="number"||n<0||n===Number.POSITIVE_INFINITY)){throw new Error("Expected positive finite index for child node")}if(r!==undefined&&r!==null&&(!r.type||!r.children)){throw new Error("Expected parent node")}if(!e||!e.type||typeof e.type!=="string"){return false}if((r===undefined||r===null)!==(n===undefined||n===null)){throw new Error("Expected both parent and index")}return i.call(o,e,n,r)};const convertElement=function(e){if(e===undefined||e===null){return hast_util_is_element_element}if(typeof e==="string"){return tagNameFactory(e)}if(typeof e==="object"){return anyFactory(e)}if(typeof e==="function"){return castFactory(e)}throw new Error("Expected function, string, or array as test")};function anyFactory(e){const t=[];let n=-1;while(++n<e.length){t[n]=convertElement(e[n])}return castFactory(any);function any(...e){let n=-1;while(++n<t.length){if(t[n].call(this,...e)){return true}}return false}}function tagNameFactory(e){return tagName;function tagName(t){return hast_util_is_element_element(t)&&t.tagName===e}}function castFactory(e){return assertion;function assertion(t,...n){return hast_util_is_element_element(t)&&Boolean(e.call(this,t,...n))}}function hast_util_is_element_element(e){return Boolean(e&&typeof e==="object"&&e.type==="element"&&typeof e.tagName==="string")}const r=function is(e,t,n,r,o){const i=convert(t);if(n!==undefined&&n!==null&&(typeof n!=="number"||n<0||n===Number.POSITIVE_INFINITY)){throw new Error("Expected positive finite index")}if(r!==undefined&&r!==null&&(!is(r)||!r.children)){throw new Error("Expected parent node")}if((r===undefined||r===null)!==(n===undefined||n===null)){throw new Error("Expected both parent and index")}return e&&e.type&&typeof e.type==="string"?Boolean(i.call(o,e,n,r)):false};const convert=function(e){if(e===undefined||e===null){return ok}if(typeof e==="string"){return typeFactory(e)}if(typeof e==="object"){return Array.isArray(e)?unist_util_is_anyFactory(e):propsFactory(e)}if(typeof e==="function"){return unist_util_is_castFactory(e)}throw new Error("Expected function, string, or object as test")};function unist_util_is_anyFactory(e){const t=[];let n=-1;while(++n<e.length){t[n]=convert(e[n])}return unist_util_is_castFactory(any);function any(...e){let n=-1;while(++n<t.length){if(t[n].call(this,...e))return true}return false}}function propsFactory(e){return unist_util_is_castFactory(all);function all(t){let n;for(n in e){if(t[n]!==e[n])return false}return true}}function typeFactory(e){return unist_util_is_castFactory(type);function type(t){return t&&t.type===e}}function unist_util_is_castFactory(e){return assertion;function assertion(...t){return Boolean(e.call(this,...t))}}function ok(){return true}function color(e){return"[33m"+e+"[39m"}const o=true;const i="skip";const u=false;const visitParents=function(e,t,n,r){if(typeof t==="function"&&typeof n!=="function"){r=n;n=t;t=null}const o=convert(t);const a=r?-1:1;factory(e,null,[])();function factory(e,c,f){const l=typeof e==="object"&&e!==null?e:{};let s;if(typeof l.type==="string"){s=typeof l.tagName==="string"?l.tagName:typeof l.name==="string"?l.name:undefined;Object.defineProperty(visit,"name",{value:"node ("+color(l.type+(s?"<"+s+">":""))+")"})}return visit;function visit(){let l=[];let s;let p;let y;if(!t||o(e,c,f[f.length-1]||null)){l=toResult(n(e,f));if(l[0]===u){return l}}if(e.children&&l[0]!==i){p=(r?e.children.length:-1)+a;y=f.concat(e);while(p>-1&&p<e.children.length){s=factory(e.children[p],p,y)();if(s[0]===u){return s}p=typeof s[1]==="number"?s[1]:p+a}}return l}}};function toResult(e){if(Array.isArray(e)){return e}if(typeof e==="number"){return[o,e]}return[e]}const visit=function(e,t,n,r){if(typeof t==="function"&&typeof n!=="function"){r=n;n=t;t=null}visitParents(e,t,overload,r);function overload(e,t){const r=t[t.length-1];return n(e,r?r.children.indexOf(e):null,r)}};const a={type:"element",tagName:"span",properties:{className:["icon","icon-link"]},children:[]};function rehypeAutolinkHeadings(t={}){let n=t.properties;const r=t.behaviour||t.behavior||"prepend";const o=t.content||a;const u=t.group;const c=convertElement(t.test);let f;if(r==="wrap"){f=wrap}else if(r==="before"||r==="after"){f=around}else{if(!n){n={ariaHidden:"true",tabIndex:-1}}f=inject}return e=>{visit(e,"element",((e,t,n)=>{if(headingRank(e)&&hasProperty(e,"id")&&c(e,t,n)){return f(e,t,n)}}))};function inject(t){t.children[r==="prepend"?"unshift":"push"](create(t,e(true,{},n),toChildren(o,t)));return[i]}function around(t,a,c){if(typeof a!=="number"||!c)return;const f=create(t,e(true,{},n),toChildren(o,t));let l=r==="before"?[f,t]:[t,f];if(u){const e=toNode(u,t);if(e&&!Array.isArray(e)&&e.type==="element"){e.children=l;l=[e]}}c.children.splice(a,1,...l);return[i,a+l.length]}function wrap(t){t.children=[create(t,e(true,{},n),t.children)];return[i]}function toChildren(e,t){const n=toNode(e,t);return Array.isArray(n)?n:[n]}function toNode(t,n){if(typeof t==="function")return t(n);return e(true,Array.isArray(t)?[]:{},t)}function create(e,t,n){return{type:"element",tagName:"a",properties:Object.assign({},t,{href:"#"+(e.properties||{}).id}),children:n}}}}();module.exports=n})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"rehype-autolink-headings","author":"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)","license":"MIT","types":"index.d.ts"}
|
package/dist/compiler.js
CHANGED
|
@@ -12,6 +12,8 @@ const mdx_1 = require("../compiled/@mdx-js/mdx");
|
|
|
12
12
|
const rehype_slug_1 = __importDefault(require("../compiled/rehype-slug"));
|
|
13
13
|
// @ts-ignore
|
|
14
14
|
const remark_gfm_1 = __importDefault(require("../compiled/remark-gfm"));
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
const rehype_autolink_headings_1 = __importDefault(require("../compiled/rehype-autolink-headings"));
|
|
15
17
|
// https://rehype-pretty-code.netlify.app
|
|
16
18
|
const rehypePrettyCodeOptions = {
|
|
17
19
|
theme: 'dark-plus',
|
|
@@ -37,7 +39,11 @@ async function compile(opts) {
|
|
|
37
39
|
const compiler = (0, mdx_1.createProcessor)({
|
|
38
40
|
jsx: true,
|
|
39
41
|
remarkPlugins: [remark_gfm_1.default],
|
|
40
|
-
rehypePlugins: [
|
|
42
|
+
rehypePlugins: [
|
|
43
|
+
rehype_slug_1.default,
|
|
44
|
+
[rehype_pretty_code_1.default, rehypePrettyCodeOptions],
|
|
45
|
+
rehype_autolink_headings_1.default,
|
|
46
|
+
],
|
|
41
47
|
});
|
|
42
48
|
try {
|
|
43
49
|
let result = String(await compiler.process(opts.content));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugin-docs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "@umijs/plugin-docs",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugin-docs#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"build:deps": "umi-scripts bundleDeps",
|
|
23
23
|
"build:extra": "pnpm build:css",
|
|
24
24
|
"dev": "pnpm build --watch",
|
|
25
|
-
"dev:css": "pnpm build:css --
|
|
25
|
+
"dev:css": "pnpm build:css --watch",
|
|
26
26
|
"test": "umi-scripts jest-turbo"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
@@ -36,10 +36,11 @@
|
|
|
36
36
|
"@types/keymaster": "^1.6.30",
|
|
37
37
|
"@types/react-helmet": "^6.1.5",
|
|
38
38
|
"classnames": "^2.3.1",
|
|
39
|
+
"rehype-autolink-headings": "^6.1.1",
|
|
39
40
|
"rehype-slug": "5.0.1",
|
|
40
41
|
"remark-gfm": "^3.0.1",
|
|
41
42
|
"tailwindcss": "^3.0.24",
|
|
42
|
-
"umi": "4.0.
|
|
43
|
+
"umi": "4.0.7"
|
|
43
44
|
},
|
|
44
45
|
"publishConfig": {
|
|
45
46
|
"access": "public"
|
|
@@ -51,13 +52,15 @@
|
|
|
51
52
|
"deps": [
|
|
52
53
|
"@mdx-js/mdx",
|
|
53
54
|
"rehype-slug",
|
|
54
|
-
"remark-gfm"
|
|
55
|
+
"remark-gfm",
|
|
56
|
+
"rehype-autolink-headings"
|
|
55
57
|
],
|
|
56
58
|
"externals": {},
|
|
57
59
|
"excludeDtsDeps": [
|
|
58
60
|
"@mdx-js/mdx",
|
|
59
61
|
"rehype-slug",
|
|
60
|
-
"remark-gfm"
|
|
62
|
+
"remark-gfm",
|
|
63
|
+
"rehype-autolink-headings"
|
|
61
64
|
]
|
|
62
65
|
}
|
|
63
66
|
}
|