@brillout/docpress 0.1.9 → 0.1.11
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/{src/css/Inter-Var.ttf → dist/Inter-Var-IOAEQULN.ttf} +0 -0
- package/{src/components/Sponsors/companyLogos/ccoli.svg → dist/ccoli-CHW3TQKS.svg} +0 -0
- package/{src/icons/changelog.svg → dist/changelog-IPI5F42D.svg} +0 -0
- package/{src/navigation/navigation-fullscreen/chevron.svg → dist/chevron-K3WPYLOP.svg} +0 -0
- package/{src/components/features/chevron.svg → dist/chevron-R2IYJD62.svg} +0 -0
- package/dist/chunk-2SRWLPTC.js +9 -0
- package/dist/chunk-2SRWLPTC.js.map +1 -0
- package/dist/chunk-G2A5MZJA.js +48 -0
- package/dist/chunk-G2A5MZJA.js.map +1 -0
- package/dist/chunk-M7LTQJLV.js +178 -0
- package/dist/chunk-M7LTQJLV.js.map +1 -0
- package/dist/chunk-OEVBWUR6.js +92 -0
- package/dist/chunk-OEVBWUR6.js.map +1 -0
- package/dist/chunk-P6M6A4HU.js +154 -0
- package/dist/chunk-P6M6A4HU.js.map +1 -0
- package/dist/chunk-TTLAZ2T2.js +8 -0
- package/dist/chunk-TTLAZ2T2.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +12 -8
- package/dist/cli/index.js.map +1 -0
- package/{src/navigation/navigation-fullscreen/close.svg → dist/close-IQXTDOHV.svg} +0 -0
- package/{src/utils/Emoji/compass.svg → dist/compass-2RWQU3E4.svg} +0 -0
- package/{src → dist}/components/features/FeatureList.css +2 -7
- package/dist/components/features/FeatureList.css.map +1 -0
- package/dist/components/features/FeatureList.d.ts +13 -0
- package/dist/components/features/FeatureList.js +8 -0
- package/dist/components/features/FeatureList.js.map +1 -0
- package/dist/components/features/initFeatureList.d.ts +3 -0
- package/dist/components/features/initFeatureList.js +60 -0
- package/dist/components/features/initFeatureList.js.map +1 -0
- package/{src/components/Sponsors/companyLogos/contra.svg → dist/contra-WLZBOPBV.svg} +0 -0
- package/dist/{cli/devServer.js → devServer-TDBL5PHQ.js} +4 -2
- package/dist/devServer-TDBL5PHQ.js.map +1 -0
- package/{src/icons/discord.svg → dist/discord-JD33TUSF.svg} +0 -0
- package/{src/utils/Emoji/engine.png → dist/engine-6Q6VSCVA.png} +0 -0
- package/{src/icons/github.svg → dist/github-P5ZSKN2N.svg} +0 -0
- package/{src/icons/heart.svg → dist/heart-OINVKOXO.svg} +0 -0
- package/dist/index.css +121 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +137 -0
- package/dist/index.js +489 -0
- package/dist/index.js.map +1 -0
- package/{src/components/Sponsors/label.svg → dist/label-MP75CTIA.svg} +0 -0
- package/{src/utils/Emoji/mechanical-arm.svg → dist/mechanical-arm-TR7IQQMG.svg} +0 -0
- package/{src/components/Sponsors/medalBronze.svg → dist/medalBronze-CO4CTUR4.svg} +0 -0
- package/{src/components/Sponsors/medalGold.svg → dist/medalGold-UP6A73FL.svg} +0 -0
- package/{src/components/Sponsors/medalSilver.svg → dist/medalSilver-FAPGGOBN.svg} +0 -0
- package/{src/components/Sponsors/companyLogos/mfqs.svg → dist/mfqs-2EAEE7N6.svg} +0 -0
- package/dist/renderer/_default.page.client.css +263 -0
- package/dist/renderer/_default.page.client.css.map +1 -0
- package/dist/renderer/_default.page.client.d.ts +1 -0
- package/dist/renderer/_default.page.client.js +180 -0
- package/dist/renderer/_default.page.client.js.map +1 -0
- package/dist/renderer/_default.page.server.css +312 -0
- package/dist/renderer/_default.page.server.css.map +1 -0
- package/dist/renderer/_default.page.server.d.ts +22 -0
- package/dist/renderer/_default.page.server.js +602 -0
- package/dist/renderer/_default.page.server.js.map +1 -0
- package/{src/utils/Emoji/road-fork.svg → dist/road-fork-3WZLW3HB.svg} +0 -0
- package/{src/utils/Emoji/shield.svg → dist/shield-CU45RG5C.svg} +0 -0
- package/{src/icons/twitter.svg → dist/twitter-I7DXDN3J.svg} +0 -0
- package/{src/utils/Emoji/typescript.svg → dist/typescript-ALIPKLRM.svg} +0 -0
- package/dist/vite.config.d.ts +5 -0
- package/dist/vite.config.js +150 -0
- package/dist/vite.config.js.map +1 -0
- package/package.json +20 -26
- package/readme.md +4 -2
- package/cli.mjs +0 -2
- package/dist/cli/chunk-Y3OKG4SS.js +0 -30
- package/dist/cli/configFile.js +0 -6
- package/index.ts +0 -2
- package/src/MobileHeader.tsx +0 -68
- package/src/PageLayout.css +0 -41
- package/src/PageLayout.tsx +0 -37
- package/src/algolia/DocSearch.css +0 -29
- package/src/algolia/DocSearch.ts +0 -37
- package/src/autoScrollNav.ts +0 -22
- package/src/components/CodeBlock.tsx +0 -22
- package/src/components/DocLink.tsx +0 -108
- package/src/components/EditPageNote.tsx +0 -18
- package/src/components/HorizontalLine.tsx +0 -20
- package/src/components/ImportMeta.tsx +0 -11
- package/src/components/Info.tsx +0 -12
- package/src/components/Link.tsx +0 -18
- package/src/components/Note.tsx +0 -31
- package/src/components/P.css +0 -8
- package/src/components/P.tsx +0 -8
- package/src/components/ReadingRecommendation.tsx +0 -53
- package/src/components/RepoLink.tsx +0 -24
- package/src/components/Sponsors/companyLogos/ccoli-logo.svg +0 -1
- package/src/components/Sponsors/companyLogos/ccoli-text.svg +0 -1
- package/src/components/Sponsors/label.draft.svg +0 -108
- package/src/components/Sponsors.tsx +0 -243
- package/src/components/features/FeatureList.tsx +0 -114
- package/src/components/features/initFeatureList.ts +0 -66
- package/src/components/index.ts +0 -13
- package/src/config/Config.ts +0 -30
- package/src/config/getConfig.ts +0 -18
- package/src/config/resolveConfig/resolveHeading.ts +0 -0
- package/src/config/resolvePageContext.ts +0 -157
- package/src/css/button.css +0 -7
- package/src/css/code/block.css +0 -36
- package/src/css/code/inline.css +0 -27
- package/src/css/code.css +0 -20
- package/src/css/colorize-on-hover.css +0 -29
- package/src/css/font.css +0 -19
- package/src/css/heading.css +0 -25
- package/src/css/index.css +0 -10
- package/src/css/link.css +0 -17
- package/src/css/note.css +0 -26
- package/src/css/reset.css +0 -12
- package/src/css/table.css +0 -14
- package/src/css/tooltip.css +0 -11
- package/src/headings.ts +0 -201
- package/src/index.ts +0 -3
- package/src/installSectionUrlHashs.ts +0 -50
- package/src/navigation/Navigation-highlight.css +0 -41
- package/src/navigation/Navigation-items.css +0 -122
- package/src/navigation/Navigation-layout.css +0 -118
- package/src/navigation/Navigation.client.old.ts +0 -303
- package/src/navigation/Navigation.client.ts +0 -19
- package/src/navigation/Navigation.css +0 -12
- package/src/navigation/Navigation.tsx +0 -229
- package/src/navigation/NavigationHeader.tsx +0 -97
- package/src/navigation/navigation-fullscreen/NavigationFullscreenButton.css +0 -32
- package/src/navigation/navigation-fullscreen/NavigationFullscreenButton.tsx +0 -44
- package/src/navigation/navigation-fullscreen/initNavigationFullscreen.ts +0 -115
- package/src/parseEmojis.ts +0 -33
- package/src/renderer/_default.page.client.ts +0 -7
- package/src/renderer/_default.page.server.tsx +0 -69
- package/src/renderer/usePageContext.tsx +0 -25
- package/src/types.ts +0 -2
- package/src/utils/Emoji/Emoji.ts +0 -216
- package/src/utils/Emoji/assets.ts +0 -9
- package/src/utils/Emoji/index.ts +0 -1
- package/src/utils/Emoji/mountain.svg +0 -1
- package/src/utils/assert.ts +0 -39
- package/src/utils/determineSectionUrlHash.ts +0 -35
- package/src/utils/filter.ts +0 -12
- package/src/utils/index.ts +0 -6
- package/src/utils/isBrowser.ts +0 -5
- package/src/utils/jsxToTextContent.ts +0 -11
- package/src/utils/objectAssign.ts +0 -9
- package/vite.config/markdownHeadings.ts +0 -128
- package/vite.config.ts +0 -42
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" width="1em" height="1em" style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" preserveAspectRatio="xMidYMid meet" viewBox="0 0 128 128"><linearGradient id="IconifyId-17a99f60578-807714-36" x1="43.401" x2="66.946" y1="35.388" y2="110.95" gradientUnits="userSpaceOnUse"><stop stop-color="#607D8B" offset="0"/><stop stop-color="#57727F" offset=".4"/><stop stop-color="#455A64" offset="1"/></linearGradient><path d="M119.04 73.55c-1.44-2.68-2.99-4.84-4.61-6.24v-.01c-.06-.06-.13-.1-.19-.16c-.13-.11-.26-.22-.39-.31c-.23-.17-.46-.33-.69-.47c-.44-.26-.87-.55-1.29-.85c-.12-.08-.24-.17-.35-.26c-7.1-5.26-12.5-15.94-16.52-22.86c-1.83-3.78-3.65-6.46-5.44-6.46c-.37 0-.81.19-1.29.48c-1.06.63-2.39 1.94-3.93 3.78c-5.27-3.29-5.44-20.97-10.08-20.97c-2.3 0-4.09-6.19-6.35-10.67c-.01-.01-.01-.02-.02-.03c-.17.21-.17.21 0 0c-.32-.63-.64-1.22-.98-1.76c-.67-1.08-1.39-1.93-2.18-2.39c-.39-.23-.8-.36-1.24-.37c-.82-.02-1.75.5-2.76 1.43c-.76.7-1.57 1.62-2.4 2.73c-.56.74-1.13 1.55-1.71 2.43c-.29.44-.58.89-.87 1.36c-.59.93-1.18 1.92-1.78 2.95c-5.95 10.28-12.1 24.38-13.87 26.26c-.51.54-1.02.95-1.55 1.27c-1.57.97-3.21 1.12-4.77 1.25c-.7.06-1.38.1-2.03.22c-1.03.18-2.02.58-2.94 1.18c-.46.3-.9.65-1.31 1.05c-.21.2-.41.41-.6.64c-.19.22-.38.46-.56.71c-.19.26-.38.53-.57.81c-.05.07-.1.15-.15.23c-.15.22-.3.44-.45.68l-.15.24c-.16.25-.33.52-.5.78l-.11.17c-.18.3-.37.6-.55.92c-.02.04-.04.07-.06.11c-.17.28-.34.57-.5.86c-4.43 7.69-9.74 19.58-14.49 31.05A62.077 62.077 0 0 0 4 107.28V116h120V93.87c0-7.07-1.6-14.1-4.96-20.32zm-31.23-8.47c-.1.17-.18.32-.28.48c.1-.16.18-.31.28-.48zm-.39 41.54c-.8.92-1.59 1.87-2.38 2.8c.8-.94 1.58-1.88 2.38-2.8c.38-.43.74-.86 1.1-1.28c-.35.42-.72.84-1.1 1.28zm.06-30.55zm5-31.33c-.09-.37-.18-.74-.28-1.1c.1.36.19.73.28 1.1l.12.51l-.12-.51zm6.58 43.57c.11-.53.17-1.02.19-1.49c-.02.47-.09.96-.19 1.49z" fill="url(#IconifyId-17a99f60578-807714-36)"/><path d="M91.45 101.77c-1.18 1.5-2.52 3.12-4.02 4.85c-.8.92-1.59 1.87-2.38 2.8c.79-.93 1.58-1.88 2.38-2.8c1.5-1.73 2.84-3.35 4.02-4.85z" fill="none"/><path d="M99.25 86.15c-.02-.44-.07-.85-.16-1.24c.09.39.15.8.16 1.24z" fill="none"/><path d="M98.19 82.86z" fill="none"/><path d="M99.06 88.31c.11-.53.17-1.02.19-1.49c-.02.47-.09.96-.19 1.49z" fill="none"/><path d="M97.85 91.87c.45-.99.79-1.9 1.01-2.74c-.23.83-.56 1.74-1.01 2.74z" fill="none"/><path d="M91.45 101.77c3.15-4.01 5.2-7.25 6.4-9.9c-1.21 2.65-3.25 5.89-6.4 9.9z" fill="none"/><linearGradient id="IconifyId-17a99f60578-807714-37" x1="27.284" x2="48.617" y1="52.926" y2="122.26" gradientTransform="matrix(-1 0 0 1 128 0)" gradientUnits="userSpaceOnUse"><stop stop-color="#78909C" offset="0"/><stop stop-color="#6C8490" offset=".427"/><stop stop-color="#546E7A" offset="1"/></linearGradient><path d="M79.6 116c1.79-2.21 3.6-4.41 5.45-6.58A306.38 306.38 0 0 0 79.6 116z" fill="url(#IconifyId-17a99f60578-807714-37)"/><linearGradient id="IconifyId-17a99f60578-807714-38" x1="52.004" x2="45.004" y1="58.942" y2="118.44" gradientTransform="matrix(-1 0 0 1 128 0)" gradientUnits="userSpaceOnUse"><stop stop-color="#546E7A" offset="0"/><stop stop-color="#4C636E" offset=".37"/><stop stop-color="#37474F" offset="1"/></linearGradient><path d="M79.6 116c1.79-2.21 3.6-4.41 5.45-6.58A306.38 306.38 0 0 0 79.6 116z" fill="url(#IconifyId-17a99f60578-807714-38)"/><linearGradient id="IconifyId-17a99f60578-807714-39" x1="59.148" x2="59.148" y1="3" y2="74.391" gradientTransform="matrix(-1 0 0 1 128 0)" gradientUnits="userSpaceOnUse"><stop stop-color="#E1F5FE" offset="0"/><stop stop-color="#D5F1FD" offset=".351"/><stop stop-color="#B4E5FC" offset=".991"/><stop stop-color="#B3E5FC" offset="1"/></linearGradient><path d="M23.78 51.4c.02-.04.04-.07.06-.11c.19-.31.37-.62.55-.92l.11-.17c.17-.27.33-.53.5-.78l.15-.24c.15-.23.3-.46.45-.68c.05-.07.1-.15.15-.23c.19-.28.38-.55.57-.81c.18-.25.37-.48.56-.71c.19-.22.4-.44.6-.64c.41-.4.85-.75 1.31-1.05c.92-.6 1.91-1 2.94-1.18c.66-.11 1.34-.16 2.03-.22c1.57-.12 3.2-.28 4.77-1.25c.52-.32 1.04-.74 1.55-1.27c1.77-1.88 7.92-15.98 13.87-26.26c.6-1.03 1.19-2.02 1.78-2.95c.29-.47.59-.92.87-1.36c.58-.88 1.15-1.69 1.71-2.43c.84-1.1 1.64-2.03 2.4-2.73c1.04-.91 1.97-1.43 2.78-1.41c.43.01.84.14 1.24.37c.79.46 1.51 1.32 2.18 2.39c.34.54.66 1.13.98 1.76c-.17.21-.17.21 0 0c.01.01.01.02.02.03c2.26 4.49 4.05 10.67 6.35 10.67c4.64 0 4.81 17.69 10.08 20.97c1.53-1.84 2.86-3.15 3.93-3.78c.48-.29.92-.48 1.29-.48c1.79 0 3.61 2.68 5.44 6.46c4.33 7.44 10.24 19.25 18.17 23.97c.43.26.85.57 1.27.93c-1.52 3.03-4.15 6.24-8.18 4.92c-7-2.3-10.45.11-14.01 4.71c-.4.51-.83.89-1.29 1.19c-3.63 2.4-8.84-1.37-10.88-2.8c-2.26-1.58-10.08-3.49-17.11-.59c-.02.01-.25.09-.34.13c-7.12 3.1-11.6-6.89-11.14-17.91s-5.4-9.87-9.07-7.12c-2.83 2.12-13.96 2.88-19.14 2.44c.16-.29.33-.57.5-.86z" fill="url(#IconifyId-17a99f60578-807714-39)"/><radialGradient id="IconifyId-17a99f60578-807714-40" cx="96.5" cy="50" r="37.832" gradientUnits="userSpaceOnUse"><stop stop-color="#546E7A" offset="0"/><stop stop-color="#4C636E" offset=".37"/><stop stop-color="#37474F" offset="1"/></radialGradient><path d="M85.04 109.42c.79-.93 1.58-1.88 2.38-2.8c1.51-1.73 2.84-3.34 4.02-4.85c3.15-4.01 5.2-7.25 6.4-9.9c.45-.99.79-1.9 1.01-2.74c.08-.28.14-.55.2-.81c.11-.53.17-1.02.19-1.49c.01-.23.01-.46 0-.68c-.02-.44-.07-.85-.16-1.24a6.04 6.04 0 0 0-.9-2.05c-.21-.3-.44-.58-.7-.85c-.77-.8-1.72-1.45-2.77-2.03c-.52-.29-1.06-.57-1.61-.83c-.72-.35-1.45-.69-2.16-1.03c-.36-.17-.72-.35-1.06-.53a15.107 15.107 0 0 1-1.32-.76c-.38-.24-.76-.49-1.09-.76c-.41-.34-.78-.7-1.09-1.1c-.21-.27-.39-.55-.54-.85a5.002 5.002 0 0 1-.47-1.49c-.11-.73-.07-1.55.15-2.49c.08-.33.18-.67.3-1.03c.1-.31.24-.63.37-.96c.02-.04.03-.08.05-.13c.33-.76.76-1.58 1.28-2.46c.1-.16.17-.31.28-.48c.56-.91 1.07-1.8 1.53-2.68c.69-1.31 1.27-2.57 1.74-3.79c.32-.81.59-1.61.82-2.38c.09-.31.18-.62.26-.92c.12-.45.23-.9.32-1.34c.23-1.1.37-2.16.45-3.17a21.958 21.958 0 0 0 .01-2.91c-.04-.62-.11-1.21-.2-1.79c-.05-.29-.1-.57-.15-.85l-.12-.51c-.09-.37-.18-.74-.28-1.1c-.23-.78-.5-1.51-.8-2.2c-.2-.46-.41-.9-.63-1.32s-.45-.82-.69-1.2s-.48-.74-.72-1.09c-.36-.51-.73-.98-1.09-1.41c.48-.29.92-.48 1.29-.48c1.79 0 3.61 2.68 5.44 6.46C99 49.32 104.4 60 111.5 65.26l.35.26c.43.3.85.59 1.29.85c.23.14.46.3.69.47c.13.1.26.21.39.31c.06.05.13.1.19.16v.01c1.63 1.41 3.17 3.57 4.61 6.24C122.4 79.77 124 86.8 124 93.87V116H79.6c1.78-2.21 3.6-4.41 5.44-6.58z" fill="url(#IconifyId-17a99f60578-807714-40)"/><radialGradient id="IconifyId-17a99f60578-807714-41" cx="51.5" cy="10.75" r="83.563" gradientUnits="userSpaceOnUse"><stop stop-color="#90A4AE" offset="0"/><stop stop-color="#849AA5" offset=".226"/><stop stop-color="#65818E" offset=".633"/><stop stop-color="#607D8B" offset=".686"/><stop stop-color="#5F7C8A" offset=".697"/><stop stop-color="#57717E" offset=".848"/><stop stop-color="#546E7A" offset="1"/></radialGradient><path d="M8.79 83.31c4.75-11.46 10.06-23.36 14.49-31.05c.17-.29.34-.58.5-.86c.02-.04.04-.07.06-.11c.19-.31.37-.62.55-.92l.11-.17c.17-.27.33-.53.5-.78l.15-.24c.15-.23.3-.46.45-.68c.05-.07.1-.15.15-.23c.19-.28.38-.55.57-.81c.18-.25.37-.48.56-.71c.19-.22.4-.44.6-.64c.41-.4.85-.75 1.31-1.05c.92-.6 1.91-1 2.94-1.18c.66-.11 1.34-.16 2.03-.22c1.57-.12 3.2-.28 4.77-1.25c.52-.32 1.04-.74 1.55-1.27c1.77-1.88 7.92-15.98 13.87-26.26c.6-1.03 1.19-2.02 1.78-2.95c.29-.47.59-.92.87-1.36c.58-.88 1.15-1.69 1.71-2.43c.84-1.1 1.64-2.03 2.4-2.73c1.04-.91 1.97-1.43 2.78-1.41c.43.01.84.14 1.24.37c.79.46 1.51 1.32 2.18 2.39c.34.54.66 1.13.98 1.76c-.17.21-.17.21 0 0c.01.01.01.02.02.03c-11.53 13.77-9.16 27.69-5.53 38.75c.41.5.8 1 1.16 1.53c1.82 2.67 3.09 5.71 5.52 7.93c.85.78 1.8 1.41 2.8 1.96c6.06-9.67 12.36-18.36 12.48-18.53c1.53-1.84 2.86-3.15 3.93-3.78a20.635 20.635 0 0 1 1.81 2.5c.24.38.47.78.69 1.2s.43.86.63 1.32c.3.69.57 1.42.8 2.2c.1.36.2.72.28 1.1l.12.51c.06.28.11.56.15.85a19.982 19.982 0 0 1 .24 2.73c.01.64 0 1.29-.05 1.97c-.07 1.01-.22 2.07-.45 3.17c-.09.44-.2.89-.32 1.34c-.08.3-.16.61-.26.92c-.23.77-.51 1.57-.82 2.38a37.81 37.81 0 0 1-1.74 3.79c-.46.87-.97 1.76-1.53 2.68c-.1.17-.18.32-.28.48c-.52.88-.95 1.7-1.28 2.46c-.02.04-.03.08-.05.13a12.777 12.777 0 0 0-.67 1.99c-.22.94-.26 1.76-.15 2.49c.03.18.06.36.11.53c.09.34.21.66.36.96s.33.58.54.85c.31.4.68.76 1.09 1.1c.33.27.71.52 1.09.76c.12.07.23.15.35.22c.31.19.64.36.97.54c.35.18.7.36 1.06.53c.71.34 1.44.68 2.16 1.03c.55.27 1.09.54 1.61.83c1.04.58 2 1.23 2.77 2.03c.26.27.49.55.7.85c.42.6.73 1.28.9 2.05c.09.39.14.8.16 1.24c.01.22.01.44 0 .68c-.02.47-.09.96-.19 1.49c-.05.26-.12.53-.2.81c-.23.84-.56 1.75-1.01 2.74c-1.2 2.65-3.25 5.89-6.4 9.9c-1.18 1.5-2.52 3.12-4.02 4.85c-.8.92-1.59 1.87-2.38 2.8c-1.84 2.17-3.66 4.37-5.45 6.58H4v-8.72c0-8.22 1.64-16.36 4.79-23.96z" fill="url(#IconifyId-17a99f60578-807714-41)"/><linearGradient id="IconifyId-17a99f60578-807714-42" x1="63.668" x2="74.418" y1="21.399" y2="55.899" gradientUnits="userSpaceOnUse"><stop stop-color="#607D8B" offset="0"/><stop stop-color="#57727F" offset=".4"/><stop stop-color="#455A64" offset="1"/></linearGradient><path d="M64.87 69.15c-.43.58-1.35.18-1.2-.53c.93-4.67 2.28-11.36.08-17.38c-4.22-11.58-8.79-27.23 4.15-42.69c2.26 4.49 4.05 10.67 6.35 10.67c4.64 0 4.81 17.69 10.08 20.97c-.14.21-14.5 22.18-19.46 28.96z" fill="url(#IconifyId-17a99f60578-807714-42)"/><linearGradient id="IconifyId-17a99f60578-807714-43" x1="64" x2="64" y1="105.17" y2="83.076" gradientUnits="userSpaceOnUse"><stop stop-color="#37474F" offset="0"/><stop stop-color="#37474F" stop-opacity="0" offset="1"/></linearGradient><path d="M119.04 73.55c-1.44-2.68-2.99-4.84-4.61-6.24v-.01c-.06-.06-.13-.1-.19-.16c-.13-.11-.26-.22-.39-.31c-.23-.17-.46-.33-.69-.47c-.44-.26-.87-.55-1.29-.85c-.12-.08-.24-.17-.35-.26c-7.1-5.26-12.5-15.94-16.52-22.86c-1.83-3.78-3.65-6.46-5.44-6.46c-.37 0-.81.19-1.29.48c-1.06.63-2.39 1.94-3.93 3.78c-.12.17-6.42 8.85-12.48 18.53c-.99-.56-1.94-1.18-2.8-1.96c-2.43-2.22-3.7-5.26-5.52-7.93c-.36-.53-.76-1.04-1.16-1.53c-3.64-11.06-6-24.98 5.53-38.75c-.01-.01-.01-.02-.02-.03c-.17.21-.17.21 0 0c-.32-.63-.64-1.22-.98-1.76c-.67-1.08-1.39-1.93-2.18-2.39c-.39-.23-.8-.36-1.24-.37c-.82-.02-1.75.5-2.76 1.43c-.76.7-1.57 1.62-2.4 2.73c-.56.74-1.13 1.55-1.71 2.43c-.29.44-.58.89-.87 1.36c-.59.93-1.18 1.92-1.78 2.95c-5.95 10.28-12.1 24.38-13.87 26.26c-.51.54-1.02.95-1.55 1.27c-1.57.97-3.21 1.12-4.77 1.25c-.7.06-1.38.1-2.03.22c-1.03.18-2.02.58-2.94 1.18c-.46.3-.9.65-1.31 1.05c-.21.2-.41.41-.6.64c-.19.22-.38.46-.56.71c-.19.26-.38.53-.57.81c-.05.07-.1.15-.15.23c-.15.22-.3.44-.45.68l-.15.24c-.16.25-.33.52-.5.78l-.11.17c-.18.3-.37.6-.55.92c-.02.04-.04.07-.06.11c-.17.28-.34.57-.5.86c-4.43 7.69-9.74 19.58-14.49 31.05A62.077 62.077 0 0 0 4 107.28V116h120V93.87c0-7.07-1.6-14.1-4.96-20.32zm-31.23-8.47c-.1.17-.18.32-.28.48c.1-.16.18-.31.28-.48zm-.39 41.54c-.8.92-1.59 1.87-2.38 2.8c.8-.94 1.58-1.88 2.38-2.8c.38-.43.74-.86 1.1-1.28c-.35.42-.72.84-1.1 1.28zm.06-30.55zm5-31.33c-.09-.37-.18-.74-.28-1.1c.1.36.19.73.28 1.1l.12.51l-.12-.51zm6.58 43.57c.11-.53.17-1.02.19-1.49c-.02.47-.09.96-.19 1.49z" fill="url(#IconifyId-17a99f60578-807714-43)" opacity=".7"/><path d="M63.42 7.12c.19.18.51.53.93 1.2c.05.09.17.36.24.52c.19.42.45 1.01.87 1.53c.5 1.03.98 2.16 1.46 3.27c1.89 4.39 3.53 8.21 6.84 8.56c.82 1.09 1.83 4.9 2.45 7.24c1.42 5.36 2.89 10.9 6.4 13.21l.03.03l.14.08l.03.02l.01.01l2.17 1.32l1.65-1.99c1.49-1.8 2.41-2.6 2.89-2.95c.47.48 1.38 1.67 2.76 4.53l.05.1l.06.1c.55.94 1.12 1.95 1.72 3.01c4 7.06 8.97 15.84 15.61 20.75c.13.1.27.2.4.29c.56.4 1.04.71 1.49.98c.12.07.26.17.44.3c.07.05.13.11.2.16l.06.05c.02.02.04.04.06.05l.08.07c1.27 1.1 2.59 2.92 3.94 5.4c3.01 5.58 4.6 12.11 4.6 18.89V113H7v-5.72c0-7.84 1.53-15.51 4.56-22.81c5.74-13.85 10.56-24.18 14.32-30.7l.42-.72c.02-.04.04-.07.07-.11l.14-.24c.15-.25.3-.5.45-.74l.07-.11l.04-.06c.16-.25.31-.5.47-.74l.01-.05l.11-.17c.14-.22.28-.43.42-.63l.07-.1l.08-.11c.18-.26.35-.5.52-.74c.13-.18.27-.35.41-.51s.28-.31.42-.45c.28-.27.57-.51.88-.71c.57-.38 1.18-.62 1.8-.73c.48-.08 1.04-.13 1.63-.17l.13-.01c1.64-.13 3.88-.31 6.11-1.69c.77-.48 1.49-1.07 2.15-1.77c1.14-1.21 2.62-4.14 5.84-10.64c2.45-4.94 5.5-11.09 8.44-16.17c.6-1.03 1.18-1.99 1.72-2.86c.28-.45.56-.88.84-1.3c.56-.84 1.1-1.61 1.6-2.27c.76-1 1.44-1.78 2.04-2.33c.29-.26.5-.42.66-.52M63.45 4c-.81 0-1.72.52-2.72 1.43c-.76.7-1.57 1.62-2.4 2.73c-.56.74-1.13 1.55-1.71 2.43c-.29.44-.58.89-.87 1.36c-.59.93-1.18 1.92-1.78 2.95c-5.95 10.28-12.1 24.38-13.87 26.26c-.51.54-1.02.95-1.55 1.27c-1.57.97-3.21 1.12-4.77 1.25c-.7.06-1.38.1-2.03.22c-1.03.18-2.02.58-2.94 1.18c-.46.3-.9.65-1.31 1.05c-.21.2-.41.41-.6.64c-.19.22-.38.46-.56.71c-.19.26-.38.53-.57.81c-.05.07-.1.15-.15.23c-.15.22-.3.44-.45.68l-.15.24c-.16.25-.33.52-.5.78l-.11.17c-.18.3-.37.6-.55.92c-.02.04-.04.07-.06.11c-.17.28-.34.57-.5.86c-4.43 7.69-9.74 19.58-14.49 31.05A62.077 62.077 0 0 0 4 107.28V116h120V93.87c0-7.07-1.6-14.1-4.96-20.32c-1.44-2.68-2.99-4.84-4.61-6.24v-.01c-.06-.06-.13-.1-.19-.16c-.13-.11-.26-.22-.39-.31c-.23-.17-.46-.33-.69-.47c-.44-.26-.87-.55-1.29-.85c-.12-.08-.24-.17-.35-.26c-7.1-5.26-12.5-15.94-16.52-22.86c-1.83-3.78-3.65-6.46-5.44-6.46c-.37 0-.81.19-1.29.48c-1.06.63-2.39 1.94-3.93 3.78c-5.27-3.29-5.44-20.97-10.08-20.97c-2.3 0-4.09-6.19-6.35-10.67c-.01-.01-.01-.02-.02-.03c-.01.01-.02.02-.04.02c-.19 0-.63-1.28-.94-1.78c-.67-1.08-1.39-1.93-2.18-2.39c-.39-.23-.8-.36-1.24-.37h-.04z" fill="#424242" opacity=".2"/><path d="M37.32 53.83c.07-.46-.57-.66-.77-.24c-2.66 5.64-13.77 22.19-17.77 29.25c-.39.69.44 1.42 1.07.95c1.93-1.43 5.72-4.78 5.93-5.78c.3-1.43 2.96-5.44 3.81-6.7c.17-.24.34-.48.52-.71l3.49-4.39c.68-.86 1.17-1.85 1.42-2.92l2.3-9.46z" fill="#eee" opacity=".2"/><path d="M49.45 42.23c.16-.34-.24-.67-.54-.45l-3.66 2.62c-.26.27-.45.6-.53.97l-2.87 11.42c0 .45.63.54.76.11l6.84-14.67z" fill="#eee" opacity=".2"/><path d="M61.64 72.67c.15-.41-.39-.7-.65-.35c-3.42 4.6-16.44 17.5-21.32 23.14c-.48.55.14 1.36.8 1.05c2-.94 6.02-3.27 6.39-4.14c.53-1.24 3.65-4.36 4.65-5.34c.19-.19.39-.37.6-.54l3.94-3.32c.77-.65 1.39-1.46 1.81-2.37l3.78-8.13z" fill="#eee" opacity=".2"/><path d="M45.2 82.13c.27-.21.09-.64-.25-.59l-4.1.58c-.33.11-.62.3-.84.57l-7.2 8.09c-.19.36.29.71.57.41l11.82-9.06z" fill="#eee" opacity=".2"/><path d="M109.19 86.06c.24.25.65-.04.49-.35c-2.17-4.11-7.06-18.14-9.48-23.69c-.24-.54-1.04-.37-1.04.22c-.01 1.79.29 5.55.79 6.12c.72.82 1.92 4.2 2.29 5.27c.07.21.13.41.19.63l1.06 4.04c.21.79.58 1.52 1.1 2.15l4.6 5.61z" fill="#424242" opacity=".2"/><path d="M109.32 71.78c-.07-.27.17-.27.4-.01l3.91 4.77c.31.26.58.64.72 1l3.16 8.4l-2.88-4.43c-.13-.2-.33-.26-.31-.09l.76 6.36c.02.28-.38.05-1.08-.27l-4.68-15.73z" fill="#424242" opacity=".2"/><path d="M86.41 46.15c.16-.19.46-.11.51.13l.71 4.17c.16.26.17.58.02.84l-3.47 6.13l.29-3.63c.01-.17-.18-.26-.31-.15l-4.71 4.12c-.23.17-.53-.09-1.13-.52l8.09-11.09z" fill="#424242" opacity=".2"/><path d="M65.54 18.5c-.07-.28.17-.28.41-.01l4.03 4.92c.32.27.6.66.74 1.03l3.26 8.66l-2.97-4.57c-.14-.21-.34-.27-.32-.09l.79 6.56c.02.28-.39.05-1.12-.28L65.54 18.5z" fill="#424242" opacity=".2"/><linearGradient id="IconifyId-17a99f60578-807714-44" x1="64" x2="64" y1="99" y2="123.52" gradientUnits="userSpaceOnUse"><stop stop-color="#4CAF50" offset="0"/><stop stop-color="#48A84C" offset=".267"/><stop stop-color="#3B933F" offset=".667"/><stop stop-color="#2E7D32" offset="1"/></linearGradient><path d="M124 92.57c0-1.9-2-3.16-3.7-2.32c-4.06 2-7.41 5.21-9.59 9.17c-.59.69-1.07 1.52-1.42 2.51c-.02.07-.05.14-.07.21c-.17.51-.7.78-1.23.65c-.32-.08-.64-.12-.98-.12c-1.34 0-2.57.63-3.57 1.7c-.71.76-1.91.79-2.73.15a12.53 12.53 0 0 0-7.69-2.64c-2.2 0-4.27.58-6.08 1.58c-.87.48-1.95.18-2.54-.62c-3.56-4.84-9.18-7.98-15.52-7.98c-4.8 0-9.18 1.8-12.58 4.77c-.38.34-.94.34-1.33.01c-.9-.78-1.95-1.23-3.08-1.23c-1.1 0-2.13.43-3.01 1.17c-.34.29-.82.3-1.2.06a13.87 13.87 0 0 0-7.54-2.23c-3.9 0-7.42 1.62-9.99 4.23c-.39.4-1.02.37-1.43-.02c-.95-.92-2.1-1.47-3.34-1.47c-1.36 0-2.61.65-3.61 1.74c-.39.43-1.06.47-1.45.05c-3.57-3.84-8.59-6.24-14.15-6.22C4.96 95.76 4 96.77 4 97.98V124h120V92.57z" fill="url(#IconifyId-17a99f60578-807714-44)"/><path d="M121 93.26V121H7V98.77c4.23.2 8.16 2.04 11.13 5.24c.74.8 1.79 1.26 2.88 1.26c1.12 0 2.21-.48 2.97-1.31c.32-.35.83-.77 1.4-.77c.4 0 .83.21 1.25.62a4.04 4.04 0 0 0 2.82 1.15c1.07 0 2.08-.42 2.83-1.18c2.12-2.15 4.91-3.34 7.85-3.34c2.09 0 4.13.61 5.91 1.75c.66.42 1.42.65 2.19.65c.94 0 1.84-.33 2.56-.93c.37-.31.74-.47 1.08-.47c.36 0 .74.17 1.12.5c.73.63 1.66.98 2.62.98c.97 0 1.91-.35 2.65-1c2.97-2.6 6.74-4.03 10.6-4.03c5.17 0 9.95 2.46 13.1 6.75c.96 1.3 2.48 2.08 4.07 2.08c.82 0 1.64-.21 2.35-.61c1.44-.8 2.99-1.2 4.62-1.2c2.13 0 4.15.7 5.86 2.01c.9.69 2.02 1.07 3.15 1.07c1.37 0 2.69-.57 3.61-1.55c.32-.34.82-.75 1.38-.75c.09 0 .18.01.27.03c.32.08.64.11.96.11c1.73 0 3.26-1.1 3.81-2.73l.06-.18c.21-.6.5-1.12.87-1.55l.2-.24l.15-.27a19.17 19.17 0 0 1 7.68-7.6m.42-3.27c-.37 0-.76.08-1.12.27c-4.06 2-7.41 5.21-9.59 9.17c-.59.69-1.07 1.52-1.42 2.51c-.02.07-.05.14-.07.21a1 1 0 0 1-.97.69c-.09 0-.17-.01-.26-.03c-.32-.08-.64-.12-.98-.12c-1.34 0-2.57.63-3.57 1.7c-.38.4-.89.6-1.42.6c-.46 0-.93-.15-1.31-.45a12.53 12.53 0 0 0-7.69-2.64c-2.2 0-4.27.58-6.08 1.58c-.28.16-.59.23-.9.23c-.63 0-1.25-.31-1.65-.85c-3.56-4.84-9.18-7.98-15.52-7.98c-4.8 0-9.18 1.8-12.58 4.77a.99.99 0 0 1-1.33.01c-.9-.78-1.95-1.23-3.08-1.23c-1.1 0-2.13.43-3.01 1.17c-.18.15-.4.23-.63.23c-.2 0-.39-.06-.57-.17a13.87 13.87 0 0 0-7.54-2.23c-3.9 0-7.42 1.62-9.99 4.23c-.19.19-.44.29-.69.29c-.26 0-.53-.1-.74-.3c-.95-.92-2.1-1.47-3.34-1.47c-1.36 0-2.61.65-3.61 1.74c-.21.22-.49.34-.77.34c-.25 0-.5-.1-.68-.3c-3.55-3.83-8.54-6.22-14.08-6.22h-.08C4.96 95.76 4 96.77 4 97.98V124h120V92.57c0-1.49-1.23-2.58-2.58-2.58z" fill="#424242" opacity=".2"/><path d="M50.2 106.91c3.02.93 4.54 3.57 4.13 6.64c-.28 2.14 3.07 2.2 3.35.08c.19-1.41.04-2.77-.37-4.01c4.74-.01 8.82 2.53 10.88 6.87c.93 1.95 3.87.36 2.95-1.59c-2.62-5.52-8.29-8.93-14.39-8.62c-.44.02-.79.19-1.06.43a9.616 9.616 0 0 0-4.57-3.02c-2.05-.64-2.98 2.58-.92 3.22z" fill="#424242" opacity=".2"/><path d="M106.05 111.43c2.1.71 3.11 2.58 2.77 4.72c-.24 1.49 2.1 1.59 2.34.12c.16-.98.08-1.93-.18-2.81c3.31.08 6.12 1.93 7.48 5c.61 1.38 2.7.32 2.09-1.05c-1.73-3.91-5.63-6.4-9.9-6.29c-.31.01-.56.12-.75.28a6.692 6.692 0 0 0-3.14-2.19c-1.43-.49-2.14 1.74-.71 2.22z" fill="#424242" opacity=".2"/><path d="M24.03 109.78c-4.55.1-8.07 2.94-9.2 7.37c-.47 1.84-3.33 1.16-2.87-.68c1.45-5.68 6.11-9.5 11.99-9.63c1.9-.04 1.98 2.9.08 2.94z" fill="#424242" opacity=".2"/></svg>
|
package/src/utils/assert.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export { assert }
|
|
2
|
-
export { assertUsage }
|
|
3
|
-
|
|
4
|
-
function assert(condition: unknown, debugInfo?: unknown): asserts condition {
|
|
5
|
-
if (condition) {
|
|
6
|
-
return
|
|
7
|
-
}
|
|
8
|
-
const hasDebugInfo = debugInfo !== undefined
|
|
9
|
-
if (hasDebugInfo) {
|
|
10
|
-
console.log(debugInfo)
|
|
11
|
-
if (typeof debugInfo === 'object') {
|
|
12
|
-
debugInfo = JSON.stringify(debugInfo)
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
let errMsg = '[DocPress] Bug. Contact DocPress maintainer.'
|
|
16
|
-
if (hasDebugInfo) {
|
|
17
|
-
errMsg += ' Debug info: ' + String(debugInfo)
|
|
18
|
-
}
|
|
19
|
-
const err = new Error(errMsg)
|
|
20
|
-
if (isBrowserAndDev()) {
|
|
21
|
-
alert(err.stack)
|
|
22
|
-
}
|
|
23
|
-
throw err
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function assertUsage(condition: unknown, msg: string): asserts condition {
|
|
27
|
-
if (condition) {
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
const err = new Error('[DocPress][Wrong Usage] ' + msg)
|
|
31
|
-
if (isBrowserAndDev()) {
|
|
32
|
-
alert(err.stack)
|
|
33
|
-
}
|
|
34
|
-
throw err
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function isBrowserAndDev() {
|
|
38
|
-
return typeof window !== 'undefined' && window?.location?.port !== ''
|
|
39
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { assert } from './assert'
|
|
2
|
-
|
|
3
|
-
export { determineSectionUrlHash }
|
|
4
|
-
export { determineSectionTitle }
|
|
5
|
-
|
|
6
|
-
function determineSectionUrlHash(title: string): string {
|
|
7
|
-
const urlHash = title
|
|
8
|
-
.toLowerCase()
|
|
9
|
-
.split(/[^a-z0-9]+/)
|
|
10
|
-
.filter(Boolean)
|
|
11
|
-
.join('-')
|
|
12
|
-
return urlHash
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function determineSectionTitle(urlWithHash: string, titleNormalCase: boolean): string {
|
|
16
|
-
assert(urlWithHash.includes('#'), { urlWithHash })
|
|
17
|
-
const urlHash = urlWithHash.split('#')[1]
|
|
18
|
-
const title = urlHash
|
|
19
|
-
.split('-')
|
|
20
|
-
.map((word, i) => {
|
|
21
|
-
if (i === 0) {
|
|
22
|
-
return capitalizeFirstLetter(word)
|
|
23
|
-
}
|
|
24
|
-
if (!titleNormalCase && word.length >= 4) {
|
|
25
|
-
return capitalizeFirstLetter(word)
|
|
26
|
-
}
|
|
27
|
-
return word
|
|
28
|
-
})
|
|
29
|
-
.join(' ')
|
|
30
|
-
return title
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function capitalizeFirstLetter(word: string): string {
|
|
34
|
-
return word[0].toUpperCase() + word.slice(1)
|
|
35
|
-
}
|
package/src/utils/filter.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { filter }
|
|
2
|
-
|
|
3
|
-
// https://stackoverflow.com/questions/66341757/typescript-how-to-filter-the-object
|
|
4
|
-
function filter<T extends object>(obj: T, predicate: <K extends keyof T>(value: T[K], key: K) => boolean): T {
|
|
5
|
-
const result: { [K in keyof T]?: T[K] } = {}
|
|
6
|
-
;(Object.keys(obj) as Array<keyof T>).forEach((name) => {
|
|
7
|
-
if (predicate(obj[name], name)) {
|
|
8
|
-
result[name] = obj[name]
|
|
9
|
-
}
|
|
10
|
-
})
|
|
11
|
-
return result as T
|
|
12
|
-
}
|
package/src/utils/index.ts
DELETED
package/src/utils/isBrowser.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { assert } from './assert'
|
|
2
|
-
|
|
3
|
-
export { jsxToTextContent }
|
|
4
|
-
|
|
5
|
-
// https://stackoverflow.com/questions/34204975/react-is-there-something-similar-to-node-textcontent/60564620#60564620
|
|
6
|
-
function jsxToTextContent(node: JSX.Element | string): string {
|
|
7
|
-
if (['string', 'number'].includes(typeof node)) return String(node)
|
|
8
|
-
if (node instanceof Array) return node.map(jsxToTextContent).join('')
|
|
9
|
-
if (typeof node === 'object' && node) return jsxToTextContent(node.props.children)
|
|
10
|
-
assert(false)
|
|
11
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { assert, determineSectionUrlHash } from '../src/utils'
|
|
2
|
-
|
|
3
|
-
export { MarkdownHeading }
|
|
4
|
-
export { markdownHeadings }
|
|
5
|
-
|
|
6
|
-
type MarkdownHeading = {
|
|
7
|
-
title: string
|
|
8
|
-
id: string
|
|
9
|
-
headingLevel: number
|
|
10
|
-
titleAddendum?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function markdownHeadings() {
|
|
14
|
-
return {
|
|
15
|
-
name: 'mdx-headings',
|
|
16
|
-
enforce: 'pre',
|
|
17
|
-
transform: async (code: string, id: string) => {
|
|
18
|
-
if (!id.includes('.page.') || !id.endsWith('.mdx')) {
|
|
19
|
-
return
|
|
20
|
-
}
|
|
21
|
-
const codeNew = transform(code)
|
|
22
|
-
return codeNew
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function transform(code: string) {
|
|
28
|
-
const headings: MarkdownHeading[] = []
|
|
29
|
-
let isCodeBlock = false
|
|
30
|
-
let codeNew = code
|
|
31
|
-
.split('\n')
|
|
32
|
-
.map((line) => {
|
|
33
|
-
// Skip code blocks, e.g.
|
|
34
|
-
// ~~~md
|
|
35
|
-
// # Markdown Example
|
|
36
|
-
// Bla
|
|
37
|
-
// ~~~
|
|
38
|
-
if (line.startsWith('~~~') || line.startsWith('```')) {
|
|
39
|
-
isCodeBlock = !isCodeBlock
|
|
40
|
-
return line
|
|
41
|
-
}
|
|
42
|
-
if (isCodeBlock) {
|
|
43
|
-
return line
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (line.startsWith('#')) {
|
|
47
|
-
const { id, headingLevel, title, headingHtml } = parseMarkdownHeading(line)
|
|
48
|
-
headings.push({ id, headingLevel, title })
|
|
49
|
-
return headingHtml
|
|
50
|
-
}
|
|
51
|
-
if (line.startsWith('<h')) {
|
|
52
|
-
assert(false, { line })
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return line
|
|
56
|
-
})
|
|
57
|
-
.join('\n')
|
|
58
|
-
const headingsExportCode = `export const headings = [${headings
|
|
59
|
-
.map((heading) => JSON.stringify(heading))
|
|
60
|
-
.join(', ')}];`
|
|
61
|
-
codeNew += `\n\n${headingsExportCode}\n`
|
|
62
|
-
return codeNew
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function parseMarkdownHeading(line: string): MarkdownHeading & { headingHtml: string } {
|
|
66
|
-
const [lineBegin, ...lineWords] = line.split(' ')
|
|
67
|
-
assert(lineBegin.split('#').join('') === '', { line, lineWords })
|
|
68
|
-
const headingLevel = lineBegin.length
|
|
69
|
-
|
|
70
|
-
const titleMdx = lineWords.join(' ')
|
|
71
|
-
assert(!titleMdx.startsWith(' '), { line, lineWords })
|
|
72
|
-
assert(titleMdx, { line, lineWords })
|
|
73
|
-
|
|
74
|
-
const id = determineSectionUrlHash(titleMdx)
|
|
75
|
-
const title = titleMdx
|
|
76
|
-
|
|
77
|
-
const headingHtml = `<h${headingLevel} id="${id}">${parseTitle(title)}</h${headingLevel}>`
|
|
78
|
-
|
|
79
|
-
const heading = { headingLevel, title, id, headingHtml }
|
|
80
|
-
return heading
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function parseTitle(titleMarkdown: string): string {
|
|
84
|
-
type Part = { nodeType: 'text' | 'code'; content: string }
|
|
85
|
-
const parts: Part[] = []
|
|
86
|
-
let current: Part | undefined
|
|
87
|
-
titleMarkdown.split('').forEach((letter) => {
|
|
88
|
-
if (letter === '`') {
|
|
89
|
-
if (current?.nodeType === 'code') {
|
|
90
|
-
// </code>
|
|
91
|
-
parts.push(current)
|
|
92
|
-
current = undefined
|
|
93
|
-
} else {
|
|
94
|
-
// <code>
|
|
95
|
-
if (current) {
|
|
96
|
-
parts.push(current)
|
|
97
|
-
}
|
|
98
|
-
current = { nodeType: 'code', content: '' }
|
|
99
|
-
}
|
|
100
|
-
} else {
|
|
101
|
-
if (!current) {
|
|
102
|
-
current = { nodeType: 'text', content: '' }
|
|
103
|
-
}
|
|
104
|
-
current.content += letter
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
if (current) {
|
|
108
|
-
parts.push(current)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const titleHtml = parts
|
|
112
|
-
.map((part) => {
|
|
113
|
-
if (part.nodeType === 'code') {
|
|
114
|
-
return `<code>${serializeText(part.content)}</code>`
|
|
115
|
-
} else {
|
|
116
|
-
assert(part.nodeType === 'text', { parts })
|
|
117
|
-
return serializeText(part.content)
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
.join('')
|
|
121
|
-
|
|
122
|
-
return titleHtml
|
|
123
|
-
|
|
124
|
-
function serializeText(text: string) {
|
|
125
|
-
const textEscaped = text.split("'").join("\\'")
|
|
126
|
-
return `{'${textEscaped}'}`
|
|
127
|
-
}
|
|
128
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import mdx from '@mdx-js/rollup'
|
|
2
|
-
import react from '@vitejs/plugin-react'
|
|
3
|
-
import ssr from 'vite-plugin-ssr/plugin'
|
|
4
|
-
import { UserConfig } from 'vite'
|
|
5
|
-
import { markdownHeadings } from './vite.config/markdownHeadings'
|
|
6
|
-
import rehypePrettyCode from 'rehype-pretty-code'
|
|
7
|
-
import remarkGfm from 'remark-gfm'
|
|
8
|
-
|
|
9
|
-
const root = process.cwd()
|
|
10
|
-
const prettyCode = [rehypePrettyCode, { theme: 'github-light' }]
|
|
11
|
-
const rehypePlugins: any = [prettyCode]
|
|
12
|
-
const remarkPlugins = [remarkGfm]
|
|
13
|
-
|
|
14
|
-
const config: UserConfig = {
|
|
15
|
-
root,
|
|
16
|
-
plugins: [
|
|
17
|
-
react({
|
|
18
|
-
jsxRuntime: 'classic'
|
|
19
|
-
}),
|
|
20
|
-
markdownHeadings(),
|
|
21
|
-
mdx({ rehypePlugins, remarkPlugins }),
|
|
22
|
-
ssr({
|
|
23
|
-
prerender: {
|
|
24
|
-
noExtraDir: true
|
|
25
|
-
},
|
|
26
|
-
pageFiles: {
|
|
27
|
-
include: ['@brillout/docpress']
|
|
28
|
-
},
|
|
29
|
-
includeCSS: ['@brillout/docpress'],
|
|
30
|
-
includeAssetsImportedByServer: true
|
|
31
|
-
})
|
|
32
|
-
],
|
|
33
|
-
// TODO: remove `react`?
|
|
34
|
-
optimizeDeps: { include: ['@mdx-js/react', 'react', 'react-dom'] },
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
ssr: {
|
|
37
|
-
noExternal: ['@brillout/docpress']
|
|
38
|
-
},
|
|
39
|
-
clearScreen: false
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default config
|