@umijs/plugin-docs 4.0.3 → 4.0.6
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/tailwind.css +34 -6
- package/client/theme-doc/tailwind.out.css +162 -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 +7 -4
|
@@ -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
|
+
}
|
|
@@ -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 {
|
|
@@ -223,6 +223,34 @@ h6 {
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
@layer components {
|
|
226
|
+
|
|
227
|
+
.title-link a {
|
|
228
|
+
float: left;
|
|
229
|
+
margin-top: 0.1em;
|
|
230
|
+
margin-left: -24px;
|
|
231
|
+
width: 20px;
|
|
232
|
+
padding-right: 4px;
|
|
233
|
+
line-height: 1;
|
|
234
|
+
box-sizing: border-box;
|
|
235
|
+
background: none;
|
|
236
|
+
opacity: 0
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.title-link:hover a{
|
|
240
|
+
opacity: 1
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.title-link span{
|
|
244
|
+
display: none;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.title-link a::after{
|
|
248
|
+
content: "#";
|
|
249
|
+
display: inline-block;
|
|
250
|
+
vertical-align: middle;
|
|
251
|
+
font-size: 20px;
|
|
252
|
+
}
|
|
253
|
+
|
|
226
254
|
.features-dark {
|
|
227
255
|
@apply bg-gray-900;
|
|
228
256
|
background-image: radial-gradient(#2a2a2a 20%, transparent 20%);
|
|
@@ -1543,6 +1543,33 @@ video {
|
|
|
1543
1543
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
1544
1544
|
}
|
|
1545
1545
|
|
|
1546
|
+
article h1 a {
|
|
1547
|
+
float: left;
|
|
1548
|
+
margin-top: 0.1em;
|
|
1549
|
+
margin-left: -24px;
|
|
1550
|
+
width: 20px;
|
|
1551
|
+
padding-right: 4px;
|
|
1552
|
+
line-height: 1;
|
|
1553
|
+
box-sizing: border-box;
|
|
1554
|
+
background: none;
|
|
1555
|
+
opacity: 0
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
article h1:hover a{
|
|
1559
|
+
opacity: 1
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
article h1 span{
|
|
1563
|
+
display: none;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
article h1 a::after{
|
|
1567
|
+
content: "#";
|
|
1568
|
+
display: inline-block;
|
|
1569
|
+
vertical-align: middle;
|
|
1570
|
+
font-size: 20px;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1546
1573
|
article h1 {
|
|
1547
1574
|
margin-bottom: 1rem;
|
|
1548
1575
|
margin-top: 0.5rem;
|
|
@@ -1557,6 +1584,33 @@ article h1 {
|
|
|
1557
1584
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1558
1585
|
}
|
|
1559
1586
|
|
|
1587
|
+
article h2 a {
|
|
1588
|
+
float: left;
|
|
1589
|
+
margin-top: 0.1em;
|
|
1590
|
+
margin-left: -24px;
|
|
1591
|
+
width: 20px;
|
|
1592
|
+
padding-right: 4px;
|
|
1593
|
+
line-height: 1;
|
|
1594
|
+
box-sizing: border-box;
|
|
1595
|
+
background: none;
|
|
1596
|
+
opacity: 0
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
article h2:hover a{
|
|
1600
|
+
opacity: 1
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
article h2 span{
|
|
1604
|
+
display: none;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
article h2 a::after{
|
|
1608
|
+
content: "#";
|
|
1609
|
+
display: inline-block;
|
|
1610
|
+
vertical-align: middle;
|
|
1611
|
+
font-size: 20px;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1560
1614
|
article h2 {
|
|
1561
1615
|
margin-top: 2.5rem;
|
|
1562
1616
|
font-size: 1.875rem;
|
|
@@ -1575,6 +1629,33 @@ article h2 {
|
|
|
1575
1629
|
padding-bottom: 0.25rem;
|
|
1576
1630
|
}
|
|
1577
1631
|
|
|
1632
|
+
article h3 a {
|
|
1633
|
+
float: left;
|
|
1634
|
+
margin-top: 0.1em;
|
|
1635
|
+
margin-left: -24px;
|
|
1636
|
+
width: 20px;
|
|
1637
|
+
padding-right: 4px;
|
|
1638
|
+
line-height: 1;
|
|
1639
|
+
box-sizing: border-box;
|
|
1640
|
+
background: none;
|
|
1641
|
+
opacity: 0
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
article h3:hover a{
|
|
1645
|
+
opacity: 1
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
article h3 span{
|
|
1649
|
+
display: none;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
article h3 a::after{
|
|
1653
|
+
content: "#";
|
|
1654
|
+
display: inline-block;
|
|
1655
|
+
vertical-align: middle;
|
|
1656
|
+
font-size: 20px;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1578
1659
|
article h3 {
|
|
1579
1660
|
margin-top: 2rem;
|
|
1580
1661
|
font-size: 1.5rem;
|
|
@@ -1588,6 +1669,33 @@ article h3 {
|
|
|
1588
1669
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1589
1670
|
}
|
|
1590
1671
|
|
|
1672
|
+
article h4 a {
|
|
1673
|
+
float: left;
|
|
1674
|
+
margin-top: 0.1em;
|
|
1675
|
+
margin-left: -24px;
|
|
1676
|
+
width: 20px;
|
|
1677
|
+
padding-right: 4px;
|
|
1678
|
+
line-height: 1;
|
|
1679
|
+
box-sizing: border-box;
|
|
1680
|
+
background: none;
|
|
1681
|
+
opacity: 0
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
article h4:hover a{
|
|
1685
|
+
opacity: 1
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
article h4 span{
|
|
1689
|
+
display: none;
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
article h4 a::after{
|
|
1693
|
+
content: "#";
|
|
1694
|
+
display: inline-block;
|
|
1695
|
+
vertical-align: middle;
|
|
1696
|
+
font-size: 20px;
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1591
1699
|
article h4 {
|
|
1592
1700
|
margin-top: 2rem;
|
|
1593
1701
|
font-size: 1.25rem;
|
|
@@ -1601,6 +1709,33 @@ article h4 {
|
|
|
1601
1709
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1602
1710
|
}
|
|
1603
1711
|
|
|
1712
|
+
article h5 a {
|
|
1713
|
+
float: left;
|
|
1714
|
+
margin-top: 0.1em;
|
|
1715
|
+
margin-left: -24px;
|
|
1716
|
+
width: 20px;
|
|
1717
|
+
padding-right: 4px;
|
|
1718
|
+
line-height: 1;
|
|
1719
|
+
box-sizing: border-box;
|
|
1720
|
+
background: none;
|
|
1721
|
+
opacity: 0
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
article h5:hover a{
|
|
1725
|
+
opacity: 1
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
article h5 span{
|
|
1729
|
+
display: none;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
article h5 a::after{
|
|
1733
|
+
content: "#";
|
|
1734
|
+
display: inline-block;
|
|
1735
|
+
vertical-align: middle;
|
|
1736
|
+
font-size: 20px;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1604
1739
|
article h5 {
|
|
1605
1740
|
margin-top: 2rem;
|
|
1606
1741
|
font-size: 1.125rem;
|
|
@@ -1614,6 +1749,33 @@ article h5 {
|
|
|
1614
1749
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1615
1750
|
}
|
|
1616
1751
|
|
|
1752
|
+
article h6 a {
|
|
1753
|
+
float: left;
|
|
1754
|
+
margin-top: 0.1em;
|
|
1755
|
+
margin-left: -24px;
|
|
1756
|
+
width: 20px;
|
|
1757
|
+
padding-right: 4px;
|
|
1758
|
+
line-height: 1;
|
|
1759
|
+
box-sizing: border-box;
|
|
1760
|
+
background: none;
|
|
1761
|
+
opacity: 0
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
article h6:hover a{
|
|
1765
|
+
opacity: 1
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
article h6 span{
|
|
1769
|
+
display: none;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
article h6 a::after{
|
|
1773
|
+
content: "#";
|
|
1774
|
+
display: inline-block;
|
|
1775
|
+
vertical-align: middle;
|
|
1776
|
+
font-size: 20px;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1617
1779
|
article h6 {
|
|
1618
1780
|
margin-top: 2rem;
|
|
1619
1781
|
font-size: 1rem;
|
|
@@ -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.6",
|
|
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",
|
|
@@ -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.6"
|
|
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
|
}
|