fumadocs-core 16.0.7 → 16.0.8

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.
Files changed (54) hide show
  1. package/dist/breadcrumb.js +3 -3
  2. package/dist/chunk-A4G5V4FQ.js +47 -0
  3. package/dist/chunk-ADBHPKXG.js +78 -0
  4. package/dist/chunk-CH7YHH7V.js +222 -0
  5. package/dist/chunk-EFVXL2PP.js +144 -0
  6. package/dist/chunk-FUUVPEA5.js +29 -0
  7. package/dist/chunk-GLRQBLGN.js +59 -0
  8. package/dist/{chunk-JD3M54YF.js → chunk-HNZEUF6C.js} +4 -47
  9. package/dist/chunk-JOXPHQ2R.js +73 -0
  10. package/dist/chunk-ONG4RVCR.js +8 -0
  11. package/dist/chunk-SLIKY7GW.js +111 -0
  12. package/dist/chunk-TWIDBWFG.js +84 -0
  13. package/dist/chunk-VW3XKOZZ.js +214 -0
  14. package/dist/chunk-X2HFD5QJ.js +275 -0
  15. package/dist/chunk-XJ6ZQNEX.js +91 -0
  16. package/dist/content/github.d.ts +7 -1
  17. package/dist/content/github.js +2 -1
  18. package/dist/content/toc.js +2 -1
  19. package/dist/mdx-plugins/codeblock-utils.d.ts +29 -0
  20. package/dist/mdx-plugins/codeblock-utils.js +9 -0
  21. package/dist/mdx-plugins/index.d.ts +18 -247
  22. package/dist/mdx-plugins/index.js +42 -1326
  23. package/dist/mdx-plugins/rehype-code.d.ts +55 -0
  24. package/dist/mdx-plugins/rehype-code.js +15 -0
  25. package/dist/mdx-plugins/rehype-toc.d.ts +14 -0
  26. package/dist/mdx-plugins/rehype-toc.js +7 -0
  27. package/dist/mdx-plugins/remark-admonition.d.ts +18 -0
  28. package/dist/mdx-plugins/remark-admonition.js +8 -0
  29. package/dist/mdx-plugins/remark-code-tab.d.ts +30 -0
  30. package/dist/mdx-plugins/remark-code-tab.js +8 -0
  31. package/dist/mdx-plugins/remark-gfm.d.ts +1 -0
  32. package/dist/mdx-plugins/remark-gfm.js +7 -0
  33. package/dist/mdx-plugins/remark-heading.d.ts +31 -0
  34. package/dist/mdx-plugins/remark-heading.js +8 -0
  35. package/dist/mdx-plugins/remark-image.d.ts +57 -0
  36. package/dist/mdx-plugins/remark-image.js +7 -0
  37. package/dist/mdx-plugins/remark-mdx-files.d.ts +40 -0
  38. package/dist/mdx-plugins/remark-mdx-files.js +7 -0
  39. package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +15 -0
  40. package/dist/mdx-plugins/remark-mdx-mermaid.js +7 -0
  41. package/dist/mdx-plugins/remark-npm.d.ts +31 -0
  42. package/dist/mdx-plugins/remark-npm.js +8 -0
  43. package/dist/mdx-plugins/remark-steps.d.ts +23 -0
  44. package/dist/mdx-plugins/remark-steps.js +7 -0
  45. package/dist/{remark-structure-BJxaB5zZ.d.ts → mdx-plugins/remark-structure.d.ts} +1 -1
  46. package/dist/mdx-plugins/remark-structure.js +10 -0
  47. package/dist/search/algolia.d.ts +1 -1
  48. package/dist/search/client.d.ts +1 -1
  49. package/dist/search/orama-cloud.d.ts +3 -2
  50. package/dist/search/server.d.ts +1 -1
  51. package/dist/search/server.js +3 -3
  52. package/dist/source/index.js +3 -3
  53. package/package.json +11 -7
  54. package/dist/remark-code-tab-DmyIyi6m.d.ts +0 -57
@@ -1,1334 +1,50 @@
1
1
  import {
2
- defaultThemes,
3
- getHighlighter
4
- } from "../chunk-XN2LKXFZ.js";
2
+ remarkImage
3
+ } from "../chunk-VW3XKOZZ.js";
5
4
  import {
6
- flattenNode,
7
- remarkHeading,
8
- toMdxExport
9
- } from "../chunk-JD3M54YF.js";
10
- import "../chunk-U67V476Y.js";
11
-
12
- // src/mdx-plugins/index.ts
5
+ remarkMdxFiles
6
+ } from "../chunk-ADBHPKXG.js";
13
7
  import {
14
- default as default2
15
- } from "remark-gfm";
16
-
17
- // src/mdx-plugins/rehype-code.ts
18
- import rehypeShikiFromHighlighter from "@shikijs/rehype/core";
8
+ remarkMdxMermaid
9
+ } from "../chunk-FUUVPEA5.js";
19
10
  import {
20
- transformerNotationDiff,
21
- transformerNotationFocus,
22
- transformerNotationHighlight,
23
- transformerNotationWordHighlight
24
- } from "@shikijs/transformers";
11
+ remarkNpm
12
+ } from "../chunk-GLRQBLGN.js";
25
13
  import {
26
- bundledLanguages
27
- } from "shiki";
28
-
29
- // src/mdx-plugins/transformer-icon.ts
30
- var defaultShortcuts = {
31
- js: "javascript",
32
- jsx: "react",
33
- ts: "typescript",
34
- tsx: "react",
35
- "c#": "csharp",
36
- cs: "csharp",
37
- gql: "graphql",
38
- py: "python",
39
- bash: "shellscript",
40
- sh: "shellscript",
41
- shell: "shellscript",
42
- zsh: "shellscript",
43
- "c++": "cpp"
44
- };
45
- var defaultIcons = {
46
- react: {
47
- viewBox: "0 0 24 24",
48
- fill: "currentColor",
49
- d: "M14.23 12.004a2.236 2.236 0 0 1-2.235 2.236 2.236 2.236 0 0 1-2.236-2.236 2.236 2.236 0 0 1 2.235-2.236 2.236 2.236 0 0 1 2.236 2.236zm2.648-10.69c-1.346 0-3.107.96-4.888 2.622-1.78-1.653-3.542-2.602-4.887-2.602-.41 0-.783.093-1.106.278-1.375.793-1.683 3.264-.973 6.365C1.98 8.917 0 10.42 0 12.004c0 1.59 1.99 3.097 5.043 4.03-.704 3.113-.39 5.588.988 6.38.32.187.69.275 1.102.275 1.345 0 3.107-.96 4.888-2.624 1.78 1.654 3.542 2.603 4.887 2.603.41 0 .783-.09 1.106-.275 1.374-.792 1.683-3.263.973-6.365C22.02 15.096 24 13.59 24 12.004c0-1.59-1.99-3.097-5.043-4.032.704-3.11.39-5.587-.988-6.38-.318-.184-.688-.277-1.092-.278zm-.005 1.09v.006c.225 0 .406.044.558.127.666.382.955 1.835.73 3.704-.054.46-.142.945-.25 1.44-.96-.236-2.006-.417-3.107-.534-.66-.905-1.345-1.727-2.035-2.447 1.592-1.48 3.087-2.292 4.105-2.295zm-9.77.02c1.012 0 2.514.808 4.11 2.28-.686.72-1.37 1.537-2.02 2.442-1.107.117-2.154.298-3.113.538-.112-.49-.195-.964-.254-1.42-.23-1.868.054-3.32.714-3.707.19-.09.4-.127.563-.132zm4.882 3.05c.455.468.91.992 1.36 1.564-.44-.02-.89-.034-1.345-.034-.46 0-.915.01-1.36.034.44-.572.895-1.096 1.345-1.565zM12 8.1c.74 0 1.477.034 2.202.093.406.582.802 1.203 1.183 1.86.372.64.71 1.29 1.018 1.946-.308.655-.646 1.31-1.013 1.95-.38.66-.773 1.288-1.18 1.87-.728.063-1.466.098-2.21.098-.74 0-1.477-.035-2.202-.093-.406-.582-.802-1.204-1.183-1.86-.372-.64-.71-1.29-1.018-1.946.303-.657.646-1.313 1.013-1.954.38-.66.773-1.286 1.18-1.868.728-.064 1.466-.098 2.21-.098zm-3.635.254c-.24.377-.48.763-.704 1.16-.225.39-.435.782-.635 1.174-.265-.656-.49-1.31-.676-1.947.64-.15 1.315-.283 2.015-.386zm7.26 0c.695.103 1.365.23 2.006.387-.18.632-.405 1.282-.66 1.933-.2-.39-.41-.783-.64-1.174-.225-.392-.465-.774-.705-1.146zm3.063.675c.484.15.944.317 1.375.498 1.732.74 2.852 1.708 2.852 2.476-.005.768-1.125 1.74-2.857 2.475-.42.18-.88.342-1.355.493-.28-.958-.646-1.956-1.1-2.98.45-1.017.81-2.01 1.085-2.964zm-13.395.004c.278.96.645 1.957 1.1 2.98-.45 1.017-.812 2.01-1.086 2.964-.484-.15-.944-.318-1.37-.5-1.732-.737-2.852-1.706-2.852-2.474 0-.768 1.12-1.742 2.852-2.476.42-.18.88-.342 1.356-.494zm11.678 4.28c.265.657.49 1.312.676 1.948-.64.157-1.316.29-2.016.39.24-.375.48-.762.705-1.158.225-.39.435-.788.636-1.18zm-9.945.02c.2.392.41.783.64 1.175.23.39.465.772.705 1.143-.695-.102-1.365-.23-2.006-.386.18-.63.406-1.282.66-1.933zM17.92 16.32c.112.493.2.968.254 1.423.23 1.868-.054 3.32-.714 3.708-.147.09-.338.128-.563.128-1.012 0-2.514-.807-4.11-2.28.686-.72 1.37-1.536 2.02-2.44 1.107-.118 2.154-.3 3.113-.54zm-11.83.01c.96.234 2.006.415 3.107.532.66.905 1.345 1.727 2.035 2.446-1.595 1.483-3.092 2.295-4.11 2.295-.22-.005-.406-.05-.553-.132-.666-.38-.955-1.834-.73-3.703.054-.46.142-.944.25-1.438zm4.56.64c.44.02.89.034 1.345.034.46 0 .915-.01 1.36-.034-.44.572-.895 1.095-1.345 1.565-.455-.47-.91-.993-1.36-1.565z"
50
- },
51
- vue: {
52
- viewBox: "0 0 24 24",
53
- fill: "currentColor",
54
- d: "M24,1.61H14.06L12,5.16,9.94,1.61H0L12,22.39ZM12,14.08,5.16,2.23H9.59L12,6.41l2.41-4.18h4.43Z"
55
- },
56
- ruby: {
57
- viewBox: "0 0 24 24",
58
- fill: "currentColor",
59
- d: "M20.156.083c3.033.525 3.893 2.598 3.829 4.77L24 4.822 22.635 22.71 4.89 23.926h.016C3.433 23.864.15 23.729 0 19.139l1.645-3 2.819 6.586.503 1.172 2.805-9.144-.03.007.016-.03 9.255 2.956-1.396-5.431-.99-3.9 8.82-.569-.615-.51L16.5 2.114 20.159.073l-.003.01zM0 19.089zM5.13 5.073c3.561-3.533 8.157-5.621 9.922-3.84 1.762 1.777-.105 6.105-3.673 9.636-3.563 3.532-8.103 5.734-9.864 3.957-1.766-1.777.045-6.217 3.612-9.75l.003-.003z"
60
- },
61
- zig: {
62
- viewBox: "0 0 24 24",
63
- fill: "currentColor",
64
- d: "m23.53 1.02-7.686 3.45h-7.06l-2.98 3.452h7.173L.47 22.98l7.681-3.607h7.065v-.002l2.978-3.45-7.148-.001 12.482-14.9zM0 4.47v14.901h1.883l2.98-3.45H3.451v-8h.942l2.824-3.45H0zm22.117 0-2.98 3.608h1.412v7.844h-.942l-2.98 3.45H24V4.47h-1.883z"
65
- },
66
- swift: {
67
- viewBox: "0 0 24 24",
68
- fill: "currentColor",
69
- d: "M7.508 0c-.287 0-.573 0-.86.002-.241.002-.483.003-.724.01-.132.003-.263.009-.395.015A9.154 9.154 0 0 0 4.348.15 5.492 5.492 0 0 0 2.85.645 5.04 5.04 0 0 0 .645 2.848c-.245.48-.4.972-.495 1.5-.093.52-.122 1.05-.136 1.576a35.2 35.2 0 0 0-.012.724C0 6.935 0 7.221 0 7.508v8.984c0 .287 0 .575.002.862.002.24.005.481.012.722.014.526.043 1.057.136 1.576.095.528.25 1.02.495 1.5a5.03 5.03 0 0 0 2.205 2.203c.48.244.97.4 1.498.495.52.093 1.05.124 1.576.138.241.007.483.009.724.01.287.002.573.002.86.002h8.984c.287 0 .573 0 .86-.002.241-.001.483-.003.724-.01a10.523 10.523 0 0 0 1.578-.138 5.322 5.322 0 0 0 1.498-.495 5.035 5.035 0 0 0 2.203-2.203c.245-.48.4-.972.495-1.5.093-.52.124-1.05.138-1.576.007-.241.009-.481.01-.722.002-.287.002-.575.002-.862V7.508c0-.287 0-.573-.002-.86a33.662 33.662 0 0 0-.01-.724 10.5 10.5 0 0 0-.138-1.576 5.328 5.328 0 0 0-.495-1.5A5.039 5.039 0 0 0 21.152.645 5.32 5.32 0 0 0 19.654.15a10.493 10.493 0 0 0-1.578-.138 34.98 34.98 0 0 0-.722-.01C17.067 0 16.779 0 16.492 0H7.508zm6.035 3.41c4.114 2.47 6.545 7.162 5.549 11.131-.024.093-.05.181-.076.272l.002.001c2.062 2.538 1.5 5.258 1.236 4.745-1.072-2.086-3.066-1.568-4.088-1.043a6.803 6.803 0 0 1-.281.158l-.02.012-.002.002c-2.115 1.123-4.957 1.205-7.812-.022a12.568 12.568 0 0 1-5.64-4.838c.649.48 1.35.902 2.097 1.252 3.019 1.414 6.051 1.311 8.197-.002C9.651 12.73 7.101 9.67 5.146 7.191a10.628 10.628 0 0 1-1.005-1.384c2.34 2.142 6.038 4.83 7.365 5.576C8.69 8.408 6.208 4.743 6.324 4.86c4.436 4.47 8.528 6.996 8.528 6.996.154.085.27.154.36.213.085-.215.16-.437.224-.668.708-2.588-.09-5.548-1.893-7.992z"
70
- },
71
- prisma: {
72
- viewBox: "0 0 24 24",
73
- fill: "currentColor",
74
- d: "M21.8068 18.2848L13.5528.7565c-.207-.4382-.639-.7273-1.1286-.7541-.5023-.0293-.9523.213-1.2062.6253L2.266 15.1271c-.2773.4518-.2718 1.0091.0158 1.4555l4.3759 6.7786c.2608.4046.7127.6388 1.1823.6388.1332 0 .267-.0188.3987-.0577l12.7019-3.7568c.3891-.1151.7072-.3904.8737-.7553s.1633-.7828-.0075-1.1454zm-1.8481.7519L9.1814 22.2242c-.3292.0975-.6448-.1873-.5756-.5194l3.8501-18.4386c.072-.3448.5486-.3996.699-.0803l7.1288 15.138c.1344.2856-.019.6224-.325.7128z"
75
- },
76
- typescript: {
77
- viewBox: "0 0 24 24",
78
- fill: "currentColor",
79
- d: "M1.125 0C.502 0 0 .502 0 1.125v21.75C0 23.498.502 24 1.125 24h21.75c.623 0 1.125-.502 1.125-1.125V1.125C24 .502 23.498 0 22.875 0zm17.363 9.75c.612 0 1.154.037 1.627.111a6.38 6.38 0 0 1 1.306.34v2.458a3.95 3.95 0 0 0-.643-.361 5.093 5.093 0 0 0-.717-.26 5.453 5.453 0 0 0-1.426-.2c-.3 0-.573.028-.819.086a2.1 2.1 0 0 0-.623.242c-.17.104-.3.229-.393.374a.888.888 0 0 0-.14.49c0 .196.053.373.156.529.104.156.252.304.443.444s.423.276.696.41c.273.135.582.274.926.416.47.197.892.407 1.266.628.374.222.695.473.963.753.268.279.472.598.614.957.142.359.214.776.214 1.253 0 .657-.125 1.21-.373 1.656a3.033 3.033 0 0 1-1.012 1.085 4.38 4.38 0 0 1-1.487.596c-.566.12-1.163.18-1.79.18a9.916 9.916 0 0 1-1.84-.164 5.544 5.544 0 0 1-1.512-.493v-2.63a5.033 5.033 0 0 0 3.237 1.2c.333 0 .624-.03.872-.09.249-.06.456-.144.623-.25.166-.108.29-.234.373-.38a1.023 1.023 0 0 0-.074-1.089 2.12 2.12 0 0 0-.537-.5 5.597 5.597 0 0 0-.807-.444 27.72 27.72 0 0 0-1.007-.436c-.918-.383-1.602-.852-2.053-1.405-.45-.553-.676-1.222-.676-2.005 0-.614.123-1.141.369-1.582.246-.441.58-.804 1.004-1.089a4.494 4.494 0 0 1 1.47-.629 7.536 7.536 0 0 1 1.77-.201zm-15.113.188h9.563v2.166H9.506v9.646H6.789v-9.646H3.375z"
80
- },
81
- javascript: {
82
- viewBox: "0 0 24 24",
83
- fill: "currentColor",
84
- d: "M0 0h24v24H0V0zm22.034 18.276c-.175-1.095-.888-2.015-3.003-2.873-.736-.345-1.554-.585-1.797-1.14-.091-.33-.105-.51-.046-.705.15-.646.915-.84 1.515-.66.39.12.75.42.976.9 1.034-.676 1.034-.676 1.755-1.125-.27-.42-.404-.601-.586-.78-.63-.705-1.469-1.065-2.834-1.034l-.705.089c-.676.165-1.32.525-1.71 1.005-1.14 1.291-.811 3.541.569 4.471 1.365 1.02 3.361 1.244 3.616 2.205.24 1.17-.87 1.545-1.966 1.41-.811-.18-1.26-.586-1.755-1.336l-1.83 1.051c.21.48.45.689.81 1.109 1.74 1.756 6.09 1.666 6.871-1.004.029-.09.24-.705.074-1.65l.046.067zm-8.983-7.245h-2.248c0 1.938-.009 3.864-.009 5.805 0 1.232.063 2.363-.138 2.711-.33.689-1.18.601-1.566.48-.396-.196-.597-.466-.83-.855-.063-.105-.11-.196-.127-.196l-1.825 1.125c.305.63.75 1.172 1.324 1.517.855.51 2.004.675 3.207.405.783-.226 1.458-.691 1.811-1.411.51-.93.402-2.07.397-3.346.012-2.054 0-4.109 0-6.179l.004-.056z"
85
- },
86
- php: {
87
- viewBox: "0 0 24 24",
88
- fill: "currentColor",
89
- d: "M7.01 10.207h-.944l-.515 2.648h.838c.556 0 .97-.105 1.242-.314.272-.21.455-.559.55-1.049.092-.47.05-.802-.124-.995-.175-.193-.523-.29-1.047-.29zM12 5.688C5.373 5.688 0 8.514 0 12s5.373 6.313 12 6.313S24 15.486 24 12c0-3.486-5.373-6.312-12-6.312zm-3.26 7.451c-.261.25-.575.438-.917.551-.336.108-.765.164-1.285.164H5.357l-.327 1.681H3.652l1.23-6.326h2.65c.797 0 1.378.209 1.744.628.366.418.476 1.002.33 1.752a2.836 2.836 0 0 1-.305.847c-.143.255-.33.49-.561.703zm4.024.715l.543-2.799c.063-.318.039-.536-.068-.651-.107-.116-.336-.174-.687-.174H11.46l-.704 3.625H9.388l1.23-6.327h1.367l-.327 1.682h1.218c.767 0 1.295.134 1.586.401s.378.7.263 1.299l-.572 2.944h-1.389zm7.597-2.265a2.782 2.782 0 0 1-.305.847c-.143.255-.33.49-.561.703a2.44 2.44 0 0 1-.917.551c-.336.108-.765.164-1.286.164h-1.18l-.327 1.682h-1.378l1.23-6.326h2.649c.797 0 1.378.209 1.744.628.366.417.477 1.001.331 1.751zM17.766 10.207h-.943l-.516 2.648h.838c.557 0 .971-.105 1.242-.314.272-.21.455-.559.551-1.049.092-.47.049-.802-.125-.995s-.524-.29-1.047-.29z"
90
- },
91
- shellscript: {
92
- viewBox: "0 0 24 24",
93
- fill: "currentColor",
94
- d: "m 4,4 a 1,1 0 0 0 -0.7070312,0.2929687 1,1 0 0 0 0,1.4140625 L 8.5859375,11 3.2929688,16.292969 a 1,1 0 0 0 0,1.414062 1,1 0 0 0 1.4140624,0 l 5.9999998,-6 a 1.0001,1.0001 0 0 0 0,-1.414062 L 4.7070312,4.2929687 A 1,1 0 0 0 4,4 Z m 8,14 a 1,1 0 0 0 -1,1 1,1 0 0 0 1,1 h 8 a 1,1 0 0 0 1,-1 1,1 0 0 0 -1,-1 z"
95
- },
96
- c: {
97
- viewBox: "0 0 24 24",
98
- fill: "currentColor",
99
- d: "M16.5921 9.1962s-.354-3.298-3.627-3.39c-3.2741-.09-4.9552 2.474-4.9552 6.14 0 3.6651 1.858 6.5972 5.0451 6.5972 3.184 0 3.5381-3.665 3.5381-3.665l6.1041.365s.36 3.31-2.196 5.836c-2.552 2.5241-5.6901 2.9371-7.8762 2.9201-2.19-.017-5.2261.034-8.1602-2.97-2.938-3.0101-3.436-5.9302-3.436-8.8002 0-2.8701.556-6.6702 4.047-9.5502C7.444.72 9.849 0 12.254 0c10.0422 0 10.7172 9.2602 10.7172 9.2602z"
100
- },
101
- cpp: {
102
- viewBox: "0 0 24 24",
103
- fill: "currentColor",
104
- d: "M22.394 6c-.167-.29-.398-.543-.652-.69L12.926.22c-.509-.294-1.34-.294-1.848 0L2.26 5.31c-.508.293-.923 1.013-.923 1.6v10.18c0 .294.104.62.271.91.167.29.398.543.652.69l8.816 5.09c.508.293 1.34.293 1.848 0l8.816-5.09c.254-.147.485-.4.652-.69.167-.29.27-.616.27-.91V6.91c.003-.294-.1-.62-.268-.91zM12 19.11c-3.92 0-7.109-3.19-7.109-7.11 0-3.92 3.19-7.11 7.11-7.11a7.133 7.133 0 016.156 3.553l-3.076 1.78a3.567 3.567 0 00-3.08-1.78A3.56 3.56 0 008.444 12 3.56 3.56 0 0012 15.555a3.57 3.57 0 003.08-1.778l3.078 1.78A7.135 7.135 0 0112 19.11zm7.11-6.715h-.79v.79h-.79v-.79h-.79v-.79h.79v-.79h.79v.79h.79zm2.962 0h-.79v.79h-.79v-.79h-.79v-.79h.79v-.79h.79v.79h.79z"
105
- },
106
- go: {
107
- viewBox: "0 0 24 24",
108
- fill: "currentColor",
109
- d: "M1.811 10.231c-.047 0-.058-.023-.035-.059l.246-.315c.023-.035.081-.058.128-.058h4.172c.046 0 .058.035.035.07l-.199.303c-.023.036-.082.07-.117.07zM.047 11.306c-.047 0-.059-.023-.035-.058l.245-.316c.023-.035.082-.058.129-.058h5.328c.047 0 .07.035.058.07l-.093.28c-.012.047-.058.07-.105.07zm2.828 1.075c-.047 0-.059-.035-.035-.07l.163-.292c.023-.035.07-.07.117-.07h2.337c.047 0 .07.035.07.082l-.023.28c0 .047-.047.082-.082.082zm12.129-2.36c-.736.187-1.239.327-1.963.514-.176.046-.187.058-.34-.117-.174-.199-.303-.327-.548-.444-.737-.362-1.45-.257-2.115.175-.795.514-1.204 1.274-1.192 2.22.011.935.654 1.706 1.577 1.835.795.105 1.46-.175 1.987-.77.105-.13.198-.27.315-.434H10.47c-.245 0-.304-.152-.222-.35.152-.362.432-.97.596-1.274a.315.315 0 01.292-.187h4.253c-.023.316-.023.631-.07.947a4.983 4.983 0 01-.958 2.29c-.841 1.11-1.94 1.8-3.33 1.986-1.145.152-2.209-.07-3.143-.77-.865-.655-1.356-1.52-1.484-2.595-.152-1.274.222-2.419.993-3.424.83-1.086 1.928-1.776 3.272-2.02 1.098-.2 2.15-.07 3.096.571.62.41 1.063.97 1.356 1.648.07.105.023.164-.117.2m3.868 6.461c-1.064-.024-2.034-.328-2.852-1.029a3.665 3.665 0 01-1.262-2.255c-.21-1.32.152-2.489.947-3.529.853-1.122 1.881-1.706 3.272-1.95 1.192-.21 2.314-.095 3.33.595.923.63 1.496 1.484 1.648 2.605.198 1.578-.257 2.863-1.344 3.962-.771.783-1.718 1.273-2.805 1.495-.315.06-.63.07-.934.106zm2.78-4.72c-.011-.153-.011-.27-.034-.387-.21-1.157-1.274-1.81-2.384-1.554-1.087.245-1.788.935-2.045 2.033-.21.912.234 1.835 1.075 2.21.643.28 1.285.244 1.905-.07.923-.48 1.425-1.228 1.484-2.233z"
110
- },
111
- graphql: {
112
- viewBox: "0 0 24 24",
113
- fill: "currentColor",
114
- d: "M12.002 0a2.138 2.138 0 1 0 0 4.277 2.138 2.138 0 1 0 0-4.277zm8.54 4.931a2.138 2.138 0 1 0 0 4.277 2.138 2.138 0 1 0 0-4.277zm0 9.862a2.138 2.138 0 1 0 0 4.277 2.138 2.138 0 1 0 0-4.277zm-8.54 4.931a2.138 2.138 0 1 0 0 4.276 2.138 2.138 0 1 0 0-4.276zm-8.542-4.93a2.138 2.138 0 1 0 0 4.276 2.138 2.138 0 1 0 0-4.277zm0-9.863a2.138 2.138 0 1 0 0 4.277 2.138 2.138 0 1 0 0-4.277zm8.542-3.378L2.953 6.777v10.448l9.049 5.224 9.047-5.224V6.777zm0 1.601 7.66 13.27H4.34zm-1.387.371L3.97 15.037V7.363zm2.774 0 6.646 3.838v7.674zM5.355 17.44h13.293l-6.646 3.836z"
115
- },
116
- python: {
117
- viewBox: "0 0 24 24",
118
- fill: "currentColor",
119
- d: "M14.25.18l.9.2.73.26.59.3.45.32.34.34.25.34.16.33.1.3.04.26.02.2-.01.13V8.5l-.05.63-.13.55-.21.46-.26.38-.3.31-.33.25-.35.19-.35.14-.33.1-.3.07-.26.04-.21.02H8.77l-.69.05-.59.14-.5.22-.41.27-.33.32-.27.35-.2.36-.15.37-.1.35-.07.32-.04.27-.02.21v3.06H3.17l-.21-.03-.28-.07-.32-.12-.35-.18-.36-.26-.36-.36-.35-.46-.32-.59-.28-.73-.21-.88-.14-1.05-.05-1.23.06-1.22.16-1.04.24-.87.32-.71.36-.57.4-.44.42-.33.42-.24.4-.16.36-.1.32-.05.24-.01h.16l.06.01h8.16v-.83H6.18l-.01-2.75-.02-.37.05-.34.11-.31.17-.28.25-.26.31-.23.38-.2.44-.18.51-.15.58-.12.64-.1.71-.06.77-.04.84-.02 1.27.05zm-6.3 1.98l-.23.33-.08.41.08.41.23.34.33.22.41.09.41-.09.33-.22.23-.34.08-.41-.08-.41-.23-.33-.33-.22-.41-.09-.41.09zm13.09 3.95l.28.06.32.12.35.18.36.27.36.35.35.47.32.59.28.73.21.88.14 1.04.05 1.23-.06 1.23-.16 1.04-.24.86-.32.71-.36.57-.4.45-.42.33-.42.24-.4.16-.36.09-.32.05-.24.02-.16-.01h-8.22v.82h5.84l.01 2.76.02.36-.05.34-.11.31-.17.29-.25.25-.31.24-.38.2-.44.17-.51.15-.58.13-.64.09-.71.07-.77.04-.84.01-1.27-.04-1.07-.14-.9-.2-.73-.25-.59-.3-.45-.33-.34-.34-.25-.34-.16-.33-.1-.3-.04-.25-.02-.2.01-.13v-5.34l.05-.64.13-.54.21-.46.26-.38.3-.32.33-.24.35-.2.35-.14.33-.1.3-.06.26-.04.21-.02.13-.01h5.84l.69-.05.59-.14.5-.21.41-.28.33-.32.27-.35.2-.36.15-.36.1-.35.07-.32.04-.28.02-.21V6.07h2.09l.14.01zm-6.47 14.25l-.23.33-.08.41.08.41.23.33.33.23.41.08.41-.08.33-.23.23-.33.08-.41-.08-.41-.23-.33-.33-.23-.41-.08-.41.08z"
120
- },
121
- md: {
122
- viewBox: "0 0 24 24",
123
- fill: "currentColor",
124
- d: "M22.27 19.385H1.73A1.73 1.73 0 010 17.655V6.345a1.73 1.73 0 011.73-1.73h20.54A1.73 1.73 0 0124 6.345v11.308a1.73 1.73 0 01-1.73 1.731zM5.769 15.923v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.46v7.847zM21.232 12h-2.309V8.077h-2.307V12h-2.308l3.461 4.039z"
125
- },
126
- kotlin: {
127
- viewBox: "0 0 24 24",
128
- fill: "currentColor",
129
- d: "M24 24H0V0h24L12 12Z"
130
- },
131
- rust: {
132
- viewBox: "0 0 24 24",
133
- fill: "currentColor",
134
- d: "M23.8346 11.7033l-1.0073-.6236a13.7268 13.7268 0 00-.0283-.2936l.8656-.8069a.3483.3483 0 00-.1154-.578l-1.1066-.414a8.4958 8.4958 0 00-.087-.2856l.6904-.9587a.3462.3462 0 00-.2257-.5446l-1.1663-.1894a9.3574 9.3574 0 00-.1407-.2622l.49-1.0761a.3437.3437 0 00-.0274-.3361.3486.3486 0 00-.3006-.154l-1.1845.0416a6.7444 6.7444 0 00-.1873-.2268l.2723-1.153a.3472.3472 0 00-.417-.4172l-1.1532.2724a14.0183 14.0183 0 00-.2278-.1873l.0415-1.1845a.3442.3442 0 00-.49-.328l-1.076.491c-.0872-.0476-.1742-.0952-.2623-.1407l-.1903-1.1673A.3483.3483 0 0016.256.955l-.9597.6905a8.4867 8.4867 0 00-.2855-.086l-.414-1.1066a.3483.3483 0 00-.5781-.1154l-.8069.8666a9.2936 9.2936 0 00-.2936-.0284L12.2946.1683a.3462.3462 0 00-.5892 0l-.6236 1.0073a13.7383 13.7383 0 00-.2936.0284L9.9803.3374a.3462.3462 0 00-.578.1154l-.4141 1.1065c-.0962.0274-.1903.0567-.2855.086L7.744.955a.3483.3483 0 00-.5447.2258L7.009 2.348a9.3574 9.3574 0 00-.2622.1407l-1.0762-.491a.3462.3462 0 00-.49.328l.0416 1.1845a7.9826 7.9826 0 00-.2278.1873L3.8413 3.425a.3472.3472 0 00-.4171.4171l.2713 1.1531c-.0628.075-.1255.1509-.1863.2268l-1.1845-.0415a.3462.3462 0 00-.328.49l.491 1.0761a9.167 9.167 0 00-.1407.2622l-1.1662.1894a.3483.3483 0 00-.2258.5446l.6904.9587a13.303 13.303 0 00-.087.2855l-1.1065.414a.3483.3483 0 00-.1155.5781l.8656.807a9.2936 9.2936 0 00-.0283.2935l-1.0073.6236a.3442.3442 0 000 .5892l1.0073.6236c.008.0982.0182.1964.0283.2936l-.8656.8079a.3462.3462 0 00.1155.578l1.1065.4141c.0273.0962.0567.1914.087.2855l-.6904.9587a.3452.3452 0 00.2268.5447l1.1662.1893c.0456.088.0922.1751.1408.2622l-.491 1.0762a.3462.3462 0 00.328.49l1.1834-.0415c.0618.0769.1235.1528.1873.2277l-.2713 1.1541a.3462.3462 0 00.4171.4161l1.153-.2713c.075.0638.151.1255.2279.1863l-.0415 1.1845a.3442.3442 0 00.49.327l1.0761-.49c.087.0486.1741.0951.2622.1407l.1903 1.1662a.3483.3483 0 00.5447.2268l.9587-.6904a9.299 9.299 0 00.2855.087l.414 1.1066a.3452.3452 0 00.5781.1154l.8079-.8656c.0972.0111.1954.0203.2936.0294l.6236 1.0073a.3472.3472 0 00.5892 0l.6236-1.0073c.0982-.0091.1964-.0183.2936-.0294l.8069.8656a.3483.3483 0 00.578-.1154l.4141-1.1066a8.4626 8.4626 0 00.2855-.087l.9587.6904a.3452.3452 0 00.5447-.2268l.1903-1.1662c.088-.0456.1751-.0931.2622-.1407l1.0762.49a.3472.3472 0 00.49-.327l-.0415-1.1845a6.7267 6.7267 0 00.2267-.1863l1.1531.2713a.3472.3472 0 00.4171-.416l-.2713-1.1542c.0628-.0749.1255-.1508.1863-.2278l1.1845.0415a.3442.3442 0 00.328-.49l-.49-1.076c.0475-.0872.0951-.1742.1407-.2623l1.1662-.1893a.3483.3483 0 00.2258-.5447l-.6904-.9587.087-.2855 1.1066-.414a.3462.3462 0 00.1154-.5781l-.8656-.8079c.0101-.0972.0202-.1954.0283-.2936l1.0073-.6236a.3442.3442 0 000-.5892zm-6.7413 8.3551a.7138.7138 0 01.2986-1.396.714.714 0 11-.2997 1.396zm-.3422-2.3142a.649.649 0 00-.7715.5l-.3573 1.6685c-1.1035.501-2.3285.7795-3.6193.7795a8.7368 8.7368 0 01-3.6951-.814l-.3574-1.6684a.648.648 0 00-.7714-.499l-1.473.3158a8.7216 8.7216 0 01-.7613-.898h7.1676c.081 0 .1356-.0141.1356-.088v-2.536c0-.074-.0536-.0881-.1356-.0881h-2.0966v-1.6077h2.2677c.2065 0 1.1065.0587 1.394 1.2088.0901.3533.2875 1.5044.4232 1.8729.1346.413.6833 1.2381 1.2685 1.2381h3.5716a.7492.7492 0 00.1296-.0131 8.7874 8.7874 0 01-.8119.9526zM6.8369 20.024a.714.714 0 11-.2997-1.396.714.714 0 01.2997 1.396zM4.1177 8.9972a.7137.7137 0 11-1.304.5791.7137.7137 0 011.304-.579zm-.8352 1.9813l1.5347-.6824a.65.65 0 00.33-.8585l-.3158-.7147h1.2432v5.6025H3.5669a8.7753 8.7753 0 01-.2834-3.348zm6.7343-.5437V8.7836h2.9601c.153 0 1.0792.1772 1.0792.8697 0 .575-.7107.7815-1.2948.7815zm10.7574 1.4862c0 .2187-.008.4363-.0243.651h-.9c-.09 0-.1265.0586-.1265.1477v.413c0 .973-.5487 1.1846-1.0296 1.2382-.4576.0517-.9648-.1913-1.0275-.4717-.2704-1.5186-.7198-1.8436-1.4305-2.4034.8817-.5599 1.799-1.386 1.799-2.4915 0-1.1936-.819-1.9458-1.3769-2.3153-.7825-.5163-1.6491-.6195-1.883-.6195H5.4682a8.7651 8.7651 0 014.907-2.7699l1.0974 1.151a.648.648 0 00.9182.0213l1.227-1.1743a8.7753 8.7753 0 016.0044 4.2762l-.8403 1.8982a.652.652 0 00.33.8585l1.6178.7188c.0283.2875.0425.577.0425.8717zm-9.3006-9.5993a.7128.7128 0 11.984 1.0316.7137.7137 0 01-.984-1.0316zm8.3389 6.71a.7107.7107 0 01.9395-.3625.7137.7137 0 11-.9405.3635z"
135
- },
136
- csharp: {
137
- viewBox: "0 0 24 24",
138
- fill: "currentColor",
139
- d: "M1.194 7.543v8.913c0 1.103.588 2.122 1.544 2.674l7.718 4.456a3.086 3.086 0 0 0 3.088 0l7.718-4.456a3.087 3.087 0 0 0 1.544-2.674V7.543a3.084 3.084 0 0 0-1.544-2.673L13.544.414a3.086 3.086 0 0 0-3.088 0L2.738 4.87a3.085 3.085 0 0 0-1.544 2.673Zm5.403 2.914v3.087a.77.77 0 0 0 .772.772.773.773 0 0 0 .772-.772.773.773 0 0 1 1.317-.546.775.775 0 0 1 .226.546 2.314 2.314 0 1 1-4.631 0v-3.087c0-.615.244-1.203.679-1.637a2.312 2.312 0 0 1 3.274 0c.434.434.678 1.023.678 1.637a.769.769 0 0 1-.226.545.767.767 0 0 1-1.091 0 .77.77 0 0 1-.226-.545.77.77 0 0 0-.772-.772.771.771 0 0 0-.772.772Zm12.35 3.087a.77.77 0 0 1-.772.772h-.772v.772a.773.773 0 0 1-1.544 0v-.772h-1.544v.772a.773.773 0 0 1-1.317.546.775.775 0 0 1-.226-.546v-.772H12a.771.771 0 1 1 0-1.544h.772v-1.543H12a.77.77 0 1 1 0-1.544h.772v-.772a.773.773 0 0 1 1.317-.546.775.775 0 0 1 .226.546v.772h1.544v-.772a.773.773 0 0 1 1.544 0v.772h.772a.772.772 0 0 1 0 1.544h-.772v1.543h.772a.776.776 0 0 1 .772.772Zm-3.088-2.315h-1.544v1.543h1.544v-1.543Z"
140
- },
141
- default: {
142
- viewBox: "0 0 24 24",
143
- fill: "currentColor",
144
- d: "M 6,1 C 4.354992,1 3,2.354992 3,4 v 16 c 0,1.645008 1.354992,3 3,3 h 12 c 1.645008,0 3,-1.354992 3,-3 V 8 7 A 1.0001,1.0001 0 0 0 20.707031,6.2929687 l -5,-5 A 1.0001,1.0001 0 0 0 15,1 h -1 z m 0,2 h 7 v 3 c 0,1.645008 1.354992,3 3,3 h 3 v 11 c 0,0.564129 -0.435871,1 -1,1 H 6 C 5.4358712,21 5,20.564129 5,20 V 4 C 5,3.4358712 5.4358712,3 6,3 Z M 15,3.4140625 18.585937,7 H 16 C 15.435871,7 15,6.5641288 15,6 Z"
145
- }
146
- };
147
- function transformerIcon(options = {}) {
148
- const shortcuts = {
149
- ...defaultShortcuts,
150
- ...options.shortcuts
151
- };
152
- const icons = {
153
- ...defaultIcons,
154
- ...options.extend
155
- };
156
- const defaultIcon = "default" in icons ? icons.default : void 0;
157
- return {
158
- name: "rehype-code:icon",
159
- pre(pre) {
160
- const lang = this.options.lang;
161
- if (!lang) return;
162
- const iconName = lang in shortcuts ? shortcuts[lang] : lang;
163
- const icon = iconName in icons ? icons[iconName] : defaultIcon;
164
- if (icon) {
165
- pre.properties.icon = typeof icon === "string" ? icon : `<svg viewBox="${icon.viewBox}"><path d="${icon.d}" fill="${icon.fill}" /></svg>`;
166
- }
167
- return pre;
168
- }
169
- };
170
- }
171
-
172
- // src/mdx-plugins/codeblock-utils.ts
173
- function generateCodeBlockTabs({
174
- persist = false,
175
- defaultValue,
176
- triggers,
177
- tabs,
178
- ...options
179
- }) {
180
- const attributes = [];
181
- if (options.attributes) attributes.push(...options.attributes);
182
- if (defaultValue) {
183
- attributes.push({
184
- type: "mdxJsxAttribute",
185
- name: "defaultValue",
186
- value: defaultValue
187
- });
188
- }
189
- if (typeof persist === "object") {
190
- attributes.push(
191
- {
192
- type: "mdxJsxAttribute",
193
- name: "groupId",
194
- value: persist.id
195
- },
196
- {
197
- type: "mdxJsxAttribute",
198
- name: "persist",
199
- value: null
200
- }
201
- );
202
- }
203
- const children = [
204
- {
205
- type: "mdxJsxFlowElement",
206
- name: "CodeBlockTabsList",
207
- attributes: [],
208
- children: triggers.map(
209
- (trigger) => ({
210
- type: "mdxJsxFlowElement",
211
- attributes: [
212
- { type: "mdxJsxAttribute", name: "value", value: trigger.value }
213
- ],
214
- name: "CodeBlockTabsTrigger",
215
- children: trigger.children
216
- })
217
- )
218
- }
219
- ];
220
- for (const tab of tabs) {
221
- children.push({
222
- type: "mdxJsxFlowElement",
223
- name: "CodeBlockTab",
224
- attributes: [
225
- { type: "mdxJsxAttribute", name: "value", value: tab.value }
226
- ],
227
- children: tab.children
228
- });
229
- }
230
- return {
231
- type: "mdxJsxFlowElement",
232
- name: "CodeBlockTabs",
233
- attributes,
234
- children
235
- };
236
- }
237
- function parseCodeBlockAttributes(meta, allowedNames) {
238
- let str = meta;
239
- const StringRegex = /(?<=^|\s)(?<name>\w+)(?:=(?:"([^"]*)"|'([^']*)'))?/g;
240
- const attributes = {};
241
- str = str.replaceAll(StringRegex, (match, name, value_1, value_2) => {
242
- if (allowedNames && !allowedNames.includes(name)) return match;
243
- attributes[name] = value_1 ?? value_2 ?? null;
244
- return "";
245
- });
246
- return {
247
- rest: str,
248
- attributes
249
- };
250
- }
251
-
252
- // src/mdx-plugins/rehype-code.ts
253
- var rehypeCodeDefaultOptions = {
254
- lazy: true,
255
- themes: defaultThemes,
256
- defaultColor: false,
257
- defaultLanguage: "plaintext",
258
- engine: "js",
259
- transformers: [
260
- transformerNotationHighlight({
261
- matchAlgorithm: "v3"
262
- }),
263
- transformerNotationWordHighlight({
264
- matchAlgorithm: "v3"
265
- }),
266
- transformerNotationDiff({
267
- matchAlgorithm: "v3"
268
- }),
269
- transformerNotationFocus({
270
- matchAlgorithm: "v3"
271
- })
272
- ],
273
- parseMetaString(meta) {
274
- const parsed = parseCodeBlockAttributes(meta, ["title", "tab"]);
275
- const data = parsed.attributes;
276
- parsed.rest = parseLineNumber(parsed.rest, data);
277
- data.__parsed_raw = parsed.rest;
278
- return data;
279
- }
280
- };
281
- function parseLineNumber(str, data) {
282
- return str.replace(/lineNumbers=(\d+)|lineNumbers/, (_, ...args) => {
283
- data["data-line-numbers"] = true;
284
- if (args[0] !== void 0)
285
- data["data-line-numbers-start"] = Number(args[0]);
286
- return "";
287
- });
288
- }
289
- function rehypeCode(_options = {}) {
290
- const options = {
291
- ...rehypeCodeDefaultOptions,
292
- ..._options
293
- };
294
- const transformers = [...options.transformers ?? []];
295
- transformers.unshift({
296
- name: "rehype-code:pre-process",
297
- preprocess(code, { meta }) {
298
- if (meta && "__parsed_raw" in meta) {
299
- meta.__raw = meta.__parsed_raw;
300
- delete meta.__parsed_raw;
301
- }
302
- if (meta && options.filterMetaString) {
303
- meta.__raw = options.filterMetaString(meta.__raw ?? "");
304
- }
305
- return code.replace(/\n$/, "");
306
- }
307
- });
308
- if (options.icon !== false) {
309
- transformers.push(transformerIcon(options.icon));
310
- }
311
- if (options.tab !== false) {
312
- transformers.push(transformerTab());
313
- }
314
- const highlighter = getHighlighter(options.engine ?? "js", {
315
- themes: "themes" in options ? Object.values(options.themes).filter(Boolean) : [options.theme],
316
- langs: options.langs ?? (options.lazy ? ["ts", "tsx"] : Object.keys(bundledLanguages)),
317
- langAlias: options.langAlias
318
- });
319
- const transformer = highlighter.then(
320
- (loaded) => rehypeShikiFromHighlighter(loaded, {
321
- ...options,
322
- transformers
323
- })
324
- );
325
- return async (tree, file) => {
326
- await (await transformer)(tree, file, () => {
327
- });
328
- };
329
- }
330
- function transformerTab() {
331
- return {
332
- name: "rehype-code:tab",
333
- // @ts-expect-error -- types not compatible with MDX
334
- root(root) {
335
- const value = this.options.meta?.tab;
336
- if (typeof value !== "string") return root;
337
- console.warn(
338
- '[Fumadocs] For `tab="value" in codeblocks, please use `remarkCodeTab` plugin instead.'
339
- );
340
- return {
341
- type: "root",
342
- children: [
343
- {
344
- type: "mdxJsxFlowElement",
345
- name: "Tab",
346
- data: {
347
- _codeblock: true
348
- },
349
- attributes: [{ type: "mdxJsxAttribute", name: "value", value }],
350
- children: root.children
351
- }
352
- ]
353
- };
354
- }
355
- };
356
- }
357
-
358
- // src/mdx-plugins/remark-image.ts
359
- import * as path from "path";
360
- import { visit } from "unist-util-visit";
361
- import { imageSize } from "image-size";
362
- import { imageSizeFromFile } from "image-size/fromFile";
363
- import { fileURLToPath } from "url";
364
- var VALID_BLUR_EXT = [".jpeg", ".png", ".webp", ".avif", ".jpg"];
365
- var EXTERNAL_URL_REGEX = /^https?:\/\//;
366
- function remarkImage({
367
- placeholder = "blur",
368
- external = true,
369
- useImport = true,
370
- onError = "error",
371
- publicDir = path.join(process.cwd(), "public")
372
- } = {}) {
373
- return async (tree, file) => {
374
- const importsToInject = [];
375
- const promises = [];
376
- async function onImage(src, node) {
377
- if (src.type === "file" && useImport) {
378
- const variableName = `__img${importsToInject.length}`;
379
- const hasBlur = placeholder === "blur" && VALID_BLUR_EXT.some((ext) => src.file.endsWith(ext));
380
- if (!file.dirname) {
381
- throw new Error(
382
- "When `useImport` is enabled, you must specify `dirname` in the VFile passed to compiler."
383
- );
384
- }
385
- importsToInject.push({
386
- variableName,
387
- importPath: getImportPath(src.file, file.dirname)
388
- });
389
- const out = {
390
- children: [],
391
- type: "mdxJsxFlowElement",
392
- name: "img",
393
- attributes: [
394
- {
395
- type: "mdxJsxAttribute",
396
- name: "alt",
397
- value: node.alt ?? "image"
398
- },
399
- {
400
- type: "mdxJsxAttribute",
401
- name: "src",
402
- value: {
403
- type: "mdxJsxAttributeValueExpression",
404
- value: variableName,
405
- data: {
406
- estree: {
407
- body: [
408
- {
409
- type: "ExpressionStatement",
410
- expression: { type: "Identifier", name: variableName }
411
- }
412
- ],
413
- type: "Program",
414
- sourceType: "script"
415
- }
416
- }
417
- }
418
- }
419
- ]
420
- };
421
- if (hasBlur) {
422
- out.attributes.push({
423
- type: "mdxJsxAttribute",
424
- name: "placeholder",
425
- value: "blur"
426
- });
427
- }
428
- return out;
429
- }
430
- const size = await getImageSize(src, external).catch((e) => {
431
- throw new Error(
432
- `[Remark Image] Failed obtain image size for ${node.url} (public directory configured as ${publicDir})`,
433
- {
434
- cause: e
435
- }
436
- );
437
- });
438
- if (!size) return;
439
- return {
440
- type: "mdxJsxFlowElement",
441
- name: "img",
442
- attributes: [
443
- {
444
- type: "mdxJsxAttribute",
445
- name: "alt",
446
- value: node.alt ?? "image"
447
- },
448
- {
449
- type: "mdxJsxAttribute",
450
- name: "src",
451
- // `src` doesn't support file paths, we can use `node.url` for files and let the underlying framework handle it
452
- value: src.type === "url" ? src.url.toString() : node.url
453
- },
454
- {
455
- type: "mdxJsxAttribute",
456
- name: "width",
457
- value: size.width.toString()
458
- },
459
- {
460
- type: "mdxJsxAttribute",
461
- name: "height",
462
- value: size.height.toString()
463
- }
464
- ],
465
- children: []
466
- };
467
- }
468
- visit(tree, "image", (node) => {
469
- const src = parseSrc(decodeURI(node.url), publicDir, file.dirname);
470
- if (!src) return;
471
- const task = onImage(src, node).catch((e) => {
472
- if (onError === "ignore" || node.url.endsWith(".svg")) {
473
- return;
474
- }
475
- if (onError === "hide") {
476
- return {
477
- type: "mdxJsxFlowElement",
478
- name: null,
479
- attributes: [],
480
- children: []
481
- };
482
- }
483
- if (onError === "error") throw e;
484
- onError(e);
485
- }).then((res) => {
486
- if (res) Object.assign(node, res);
487
- });
488
- promises.push(task);
489
- });
490
- await Promise.all(promises);
491
- if (importsToInject.length === 0) return;
492
- const imports = importsToInject.map(
493
- ({ variableName, importPath }) => ({
494
- type: "mdxjsEsm",
495
- data: {
496
- estree: {
497
- body: [
498
- {
499
- type: "ImportDeclaration",
500
- source: { type: "Literal", value: importPath },
501
- specifiers: [
502
- {
503
- type: "ImportDefaultSpecifier",
504
- local: { type: "Identifier", name: variableName }
505
- }
506
- ]
507
- }
508
- ]
509
- }
510
- }
511
- })
512
- );
513
- tree.children.unshift(...imports);
514
- };
515
- }
516
- function getImportPath(file, dir) {
517
- const relative2 = path.relative(dir, file).replaceAll(path.sep, "/");
518
- return relative2.startsWith("../") ? relative2 : `./${relative2}`;
519
- }
520
- function parseSrc(src, publicDir, dir) {
521
- if (src.startsWith("file:///"))
522
- return { type: "file", file: fileURLToPath(src) };
523
- if (EXTERNAL_URL_REGEX.test(src)) {
524
- return {
525
- type: "url",
526
- url: new URL(src)
527
- };
528
- }
529
- if (src.startsWith("/")) {
530
- if (EXTERNAL_URL_REGEX.test(publicDir)) {
531
- const url = new URL(publicDir);
532
- const segs = [...url.pathname.split("/"), ...src.split("/")].filter(
533
- (v) => v.length > 0
534
- );
535
- url.pathname = `/${segs.join("/")}`;
536
- return { type: "url", url };
537
- }
538
- return {
539
- type: "file",
540
- file: path.join(publicDir, src)
541
- };
542
- }
543
- if (!dir) {
544
- console.warn(
545
- `[Remark Image] found relative path ${src} but missing 'dirname' in VFile, this image will be skipped for now.`
546
- );
547
- return;
548
- }
549
- return {
550
- type: "file",
551
- file: path.join(dir, src)
552
- };
553
- }
554
- async function getImageSize(src, onExternal) {
555
- if (src.type === "file") return imageSizeFromFile(src.file);
556
- if (onExternal === false) return;
557
- const { timeout } = typeof onExternal === "object" ? onExternal : {};
558
- const res = await fetch(src.url, {
559
- signal: typeof timeout === "number" ? AbortSignal.timeout(timeout) : void 0
560
- });
561
- if (!res.ok) {
562
- throw new Error(
563
- `[Remark Image] Failed to fetch ${src.url} (${res.status}): ${await res.text()}`
564
- );
565
- }
566
- return imageSize(new Uint8Array(await res.arrayBuffer()));
567
- }
568
-
569
- // src/mdx-plugins/remark-structure.ts
570
- import Slugger from "github-slugger";
571
- import { remark } from "remark";
572
- import remarkGfm from "remark-gfm";
573
- import { visit as visit2 } from "unist-util-visit";
574
- function remarkStructure({
575
- types = [
576
- "heading",
577
- "paragraph",
578
- "blockquote",
579
- "tableCell",
580
- "mdxJsxFlowElement"
581
- ],
582
- allowedMdxAttributes = (node) => {
583
- if (!node.name) return false;
584
- return ["TypeTable", "Callout"].includes(node.name);
585
- },
586
- exportAs = false
587
- } = {}) {
588
- const slugger = new Slugger();
589
- if (Array.isArray(allowedMdxAttributes)) {
590
- const arr = allowedMdxAttributes;
591
- allowedMdxAttributes = (_node, attribute) => attribute.type === "mdxJsxAttribute" && arr.includes(attribute.name);
592
- }
593
- if (Array.isArray(types)) {
594
- const arr = types;
595
- types = (node) => arr.includes(node.type);
596
- }
597
- return (tree, file) => {
598
- slugger.reset();
599
- const data = { contents: [], headings: [] };
600
- let lastHeading;
601
- if (file.data.frontmatter) {
602
- const frontmatter = file.data.frontmatter;
603
- if (frontmatter._openapi?.structuredData) {
604
- data.headings.push(...frontmatter._openapi.structuredData.headings);
605
- data.contents.push(...frontmatter._openapi.structuredData.contents);
606
- }
607
- }
608
- visit2(tree, (element) => {
609
- if (element.type === "root" || !types(element)) return;
610
- if (element.type === "heading") {
611
- element.data ||= {};
612
- element.data.hProperties ||= {};
613
- const properties = element.data.hProperties;
614
- const content2 = flattenNode(element).trim();
615
- const id = properties.id ?? slugger.slug(content2);
616
- data.headings.push({
617
- id,
618
- content: content2
619
- });
620
- lastHeading = id;
621
- return "skip";
622
- }
623
- if (element.data?._string) {
624
- for (const content2 of element.data._string) {
625
- data.contents.push({
626
- heading: lastHeading,
627
- content: content2
628
- });
629
- }
630
- return "skip";
631
- }
632
- if (element.type === "mdxJsxFlowElement" && element.name) {
633
- data.contents.push(
634
- ...element.attributes.flatMap((attribute) => {
635
- const value = typeof attribute.value === "string" ? attribute.value : attribute.value?.value;
636
- if (!value || value.length === 0) return [];
637
- if (allowedMdxAttributes && !allowedMdxAttributes(element, attribute))
638
- return [];
639
- return {
640
- heading: lastHeading,
641
- content: attribute.type === "mdxJsxAttribute" ? `${attribute.name}: ${value}` : value
642
- };
643
- })
644
- );
645
- return;
646
- }
647
- const content = flattenNode(element).trim();
648
- if (content.length === 0) return;
649
- data.contents.push({
650
- heading: lastHeading,
651
- content
652
- });
653
- return "skip";
654
- });
655
- file.data.structuredData = data;
656
- if (exportAs) {
657
- tree.children.unshift(
658
- toMdxExport(
659
- typeof exportAs === "string" ? exportAs : "structuredData",
660
- data
661
- )
662
- );
663
- }
664
- };
665
- }
666
- function structure(content, remarkPlugins = [], options = {}) {
667
- const result = remark().use(remarkGfm).use(remarkPlugins).use(remarkStructure, options).processSync(content);
668
- return result.data.structuredData;
669
- }
670
-
671
- // src/mdx-plugins/remark-admonition.ts
672
- import { visit as visit3 } from "unist-util-visit";
673
- function remarkAdmonition(options = {}) {
674
- const tag = options.tag ?? ":::";
675
- const typeMap = options.typeMap ?? {
676
- info: "info",
677
- warn: "warn",
678
- note: "info",
679
- tip: "info",
680
- warning: "warn",
681
- danger: "error"
682
- };
683
- function replaceNodes(nodes) {
684
- if (nodes.length === 0) return;
685
- let open = -1;
686
- let attributes = [];
687
- let hasIntercept = false;
688
- for (let i = 0; i < nodes.length; i++) {
689
- if (nodes[i].type !== "paragraph") continue;
690
- const text = flattenNode(nodes[i]);
691
- const typeName = Object.keys(typeMap).find(
692
- (type) => text.startsWith(`${tag}${type}`)
693
- );
694
- if (typeName) {
695
- if (open !== -1) {
696
- hasIntercept = true;
697
- continue;
698
- }
699
- open = i;
700
- attributes.push({
701
- type: "mdxJsxAttribute",
702
- name: "type",
703
- value: typeMap[typeName]
704
- });
705
- const meta = text.slice(`${tag}${typeName}`.length);
706
- if (meta.startsWith("[") && meta.endsWith("]")) {
707
- attributes.push({
708
- type: "mdxJsxAttribute",
709
- name: "title",
710
- value: meta.slice(1, -1)
711
- });
712
- }
713
- }
714
- if (open !== -1 && text === tag) {
715
- const children = nodes.slice(open + 1, i);
716
- nodes.splice(open, i - open + 1, {
717
- type: "mdxJsxFlowElement",
718
- name: "Callout",
719
- attributes,
720
- children: hasIntercept ? replaceNodes(children) : children
721
- });
722
- open = -1;
723
- hasIntercept = false;
724
- attributes = [];
725
- i = open;
726
- }
727
- }
728
- }
729
- return (tree) => {
730
- visit3(tree, (node) => {
731
- if (!("children" in node)) return;
732
- replaceNodes(node.children);
733
- });
734
- };
735
- }
736
-
737
- // src/mdx-plugins/rehype-toc.ts
738
- import { toEstree } from "hast-util-to-estree";
739
-
740
- // src/mdx-plugins/hast-utils.ts
741
- function visit4(node, tagNames, handler) {
742
- if (node.type === "element" && tagNames.includes(node.tagName)) {
743
- const result = handler(node);
744
- if (result === "skip") return;
745
- }
746
- if ("children" in node)
747
- node.children.forEach((n) => {
748
- visit4(n, tagNames, handler);
749
- });
750
- }
751
-
752
- // src/mdx-plugins/rehype-toc.ts
753
- var TocOnlyTag = "[toc]";
754
- var NoTocTag = "[!toc]";
755
- function rehypeToc({ exportToc = true } = {}) {
756
- return (tree) => {
757
- const output = [];
758
- visit4(tree, ["h1", "h2", "h3", "h4", "h5", "h6"], (element) => {
759
- const id = element.properties.id;
760
- if (typeof id !== "string") return "skip";
761
- let isTocOnly = false;
762
- const last = element.children.at(-1);
763
- if (last?.type === "text" && last.value.endsWith(TocOnlyTag)) {
764
- isTocOnly = true;
765
- last.value = last.value.substring(0, last.value.length - TocOnlyTag.length).trimEnd();
766
- } else if (last?.type === "text" && last.value.endsWith(NoTocTag)) {
767
- last.value = last.value.substring(0, last.value.length - NoTocTag.length).trimEnd();
768
- return "skip";
769
- }
770
- const estree = toEstree(element, {
771
- elementAttributeNameCase: "react",
772
- stylePropertyNameCase: "dom"
773
- });
774
- if (estree.body[0].type === "ExpressionStatement")
775
- output.push({
776
- title: estree.body[0].expression,
777
- depth: Number(element.tagName.slice(1)),
778
- url: `#${id}`
779
- });
780
- if (isTocOnly) {
781
- Object.assign(element, {
782
- type: "comment",
783
- value: ""
784
- });
785
- }
786
- return "skip";
787
- });
788
- const declaration = {
789
- type: "VariableDeclaration",
790
- kind: "const",
791
- declarations: [
792
- {
793
- type: "VariableDeclarator",
794
- id: {
795
- type: "Identifier",
796
- name: "toc"
797
- },
798
- init: {
799
- type: "ArrayExpression",
800
- elements: output.map((item) => ({
801
- type: "ObjectExpression",
802
- properties: [
803
- {
804
- type: "Property",
805
- method: false,
806
- shorthand: false,
807
- computed: false,
808
- key: {
809
- type: "Identifier",
810
- name: "depth"
811
- },
812
- value: {
813
- type: "Literal",
814
- value: item.depth
815
- },
816
- kind: "init"
817
- },
818
- {
819
- type: "Property",
820
- method: false,
821
- shorthand: false,
822
- computed: false,
823
- key: {
824
- type: "Identifier",
825
- name: "url"
826
- },
827
- value: {
828
- type: "Literal",
829
- value: item.url
830
- },
831
- kind: "init"
832
- },
833
- {
834
- type: "Property",
835
- method: false,
836
- shorthand: false,
837
- computed: false,
838
- key: {
839
- type: "Identifier",
840
- name: "title"
841
- },
842
- value: {
843
- type: "JSXFragment",
844
- openingFragment: { type: "JSXOpeningFragment" },
845
- closingFragment: { type: "JSXClosingFragment" },
846
- children: item.title.children
847
- },
848
- kind: "init"
849
- }
850
- ]
851
- }))
852
- }
853
- }
854
- ]
855
- };
856
- tree.children.push({
857
- type: "mdxjsEsm",
858
- value: "",
859
- data: {
860
- estree: {
861
- type: "Program",
862
- body: [
863
- exportToc ? {
864
- type: "ExportNamedDeclaration",
865
- declaration,
866
- attributes: [],
867
- specifiers: []
868
- } : declaration
869
- ],
870
- sourceType: "module",
871
- comments: []
872
- }
873
- }
874
- });
875
- };
876
- }
877
-
878
- // src/mdx-plugins/remark-code-tab.ts
879
- import { visit as visit5 } from "unist-util-visit";
880
- var Tabs = {
881
- convert(processor, nodes, withMdx = false, withParent = true) {
882
- const tabs = Array.from(processTabValue(nodes).entries());
883
- if (!withMdx) {
884
- const children2 = tabs.map(([name, codes]) => {
885
- return {
886
- type: "mdxJsxFlowElement",
887
- name: "Tab",
888
- attributes: [
889
- {
890
- type: "mdxJsxAttribute",
891
- name: "value",
892
- value: name
893
- }
894
- ],
895
- children: codes
896
- };
897
- });
898
- if (!withParent) return createFragment(children2);
899
- return {
900
- type: "mdxJsxFlowElement",
901
- name: "Tabs",
902
- attributes: [
903
- {
904
- type: "mdxJsxAttribute",
905
- name: "items",
906
- value: {
907
- type: "mdxJsxAttributeValueExpression",
908
- value: tabs.map(([name]) => name).join(", "),
909
- data: {
910
- estree: {
911
- type: "Program",
912
- sourceType: "module",
913
- comments: [],
914
- body: [
915
- {
916
- type: "ExpressionStatement",
917
- expression: {
918
- type: "ArrayExpression",
919
- elements: tabs.map(([name]) => ({
920
- type: "Literal",
921
- value: name
922
- }))
923
- }
924
- }
925
- ]
926
- }
927
- }
928
- }
929
- }
930
- ],
931
- children: children2
932
- };
933
- }
934
- const children = [
935
- {
936
- type: "mdxJsxFlowElement",
937
- name: "TabsList",
938
- attributes: [],
939
- children: tabs.map(([name]) => ({
940
- type: "mdxJsxFlowElement",
941
- name: "TabsTrigger",
942
- attributes: [
943
- {
944
- type: "mdxJsxAttribute",
945
- name: "value",
946
- value: name
947
- }
948
- ],
949
- children: [mdxToAst(processor, name)]
950
- }))
951
- },
952
- ...tabs.map(
953
- ([name, codes]) => ({
954
- type: "mdxJsxFlowElement",
955
- name: "TabsContent",
956
- attributes: [
957
- {
958
- type: "mdxJsxAttribute",
959
- name: "value",
960
- value: name
961
- }
962
- ],
963
- children: codes
964
- })
965
- )
966
- ];
967
- if (!withParent) return createFragment(children);
968
- return {
969
- type: "mdxJsxFlowElement",
970
- name: "Tabs",
971
- attributes: [
972
- {
973
- type: "mdxJsxAttribute",
974
- name: "defaultValue",
975
- value: tabs[0][0]
976
- }
977
- ],
978
- children
979
- };
980
- }
981
- };
982
- var CodeBlockTabs = {
983
- convert(processor, nodes, withMdx = false, withParent = true) {
984
- const tabs = Array.from(processTabValue(nodes).entries());
985
- const node = generateCodeBlockTabs({
986
- defaultValue: tabs[0][0],
987
- triggers: tabs.map(([name]) => ({
988
- value: name,
989
- children: [
990
- withMdx ? mdxToAst(processor, name) : {
991
- type: "text",
992
- value: name
993
- }
994
- ]
995
- })),
996
- tabs: tabs.map(([name, codes]) => ({
997
- value: name,
998
- children: codes
999
- }))
1000
- });
1001
- if (!withParent) return createFragment(node.children);
1002
- return node;
1003
- }
1004
- };
1005
- var Types = {
1006
- CodeBlockTabs,
1007
- Tabs
1008
- };
1009
- function remarkCodeTab(options = {}) {
1010
- const { parseMdx = false, Tabs: Tabs2 = "CodeBlockTabs" } = options;
1011
- return (tree) => {
1012
- const ignored = /* @__PURE__ */ new WeakSet();
1013
- visit5(tree, (node) => {
1014
- if (!("children" in node) || ignored.has(node)) return "skip";
1015
- let localTabs = Tabs2;
1016
- let localParseMdx = parseMdx;
1017
- let withParent = true;
1018
- if (node.type === "mdxJsxFlowElement" && node.name && node.name in Types) {
1019
- withParent = false;
1020
- localTabs = node.name;
1021
- if (node.name === "Tabs" && localParseMdx) {
1022
- localParseMdx = node.attributes.every(
1023
- (attribute) => attribute.type !== "mdxJsxAttribute" || attribute.name !== "items"
1024
- );
1025
- }
1026
- }
1027
- let start = -1;
1028
- let end = 0;
1029
- const close = () => {
1030
- if (start === -1 || start === end) return;
1031
- const replacement = Types[localTabs].convert(
1032
- this,
1033
- node.children.slice(start, end),
1034
- localParseMdx,
1035
- withParent
1036
- );
1037
- ignored.add(replacement);
1038
- node.children.splice(start, end - start, replacement);
1039
- end = start;
1040
- start = -1;
1041
- };
1042
- for (; end < node.children.length; end++) {
1043
- const child = node.children[end];
1044
- if (child.type !== "code" || !child.meta) {
1045
- close();
1046
- continue;
1047
- }
1048
- const meta = parseCodeBlockAttributes(child.meta, ["tab"]);
1049
- if (!meta.attributes.tab) {
1050
- close();
1051
- continue;
1052
- }
1053
- if (start === -1) start = end;
1054
- child.meta = meta.rest;
1055
- child.data ??= {};
1056
- child.data.tab = meta.attributes.tab;
1057
- }
1058
- close();
1059
- });
1060
- };
1061
- }
1062
- function processTabValue(nodes) {
1063
- const out = /* @__PURE__ */ new Map();
1064
- for (let i = 0; i < nodes.length; i++) {
1065
- const node = nodes[i];
1066
- const name = node.data?.tab ?? `Tab ${i + 1}`;
1067
- const li = out.get(name) ?? [];
1068
- li.push(node);
1069
- out.set(name, li);
1070
- }
1071
- return out;
1072
- }
1073
- function mdxToAst(processor, name) {
1074
- const node = processor.parse(name);
1075
- if (node.type === "root") {
1076
- node.children = node.children.flatMap((child) => {
1077
- if (child.type === "paragraph") return child.children;
1078
- return child;
1079
- });
1080
- }
1081
- return node;
1082
- }
1083
- function createFragment(children) {
1084
- return {
1085
- type: "mdxJsxFlowElement",
1086
- name: null,
1087
- attributes: [],
1088
- children
1089
- };
1090
- }
1091
-
1092
- // src/mdx-plugins/remark-steps.ts
1093
- import { visit as visit6 } from "unist-util-visit";
1094
- var StepRegex = /^(\d+)\.\s(.+)$/;
1095
- function remarkSteps({
1096
- steps = "fd-steps",
1097
- step = "fd-step"
1098
- } = {}) {
1099
- function convertToSteps(nodes) {
1100
- const depth = nodes[0].depth;
1101
- const children = [];
1102
- for (const node of nodes) {
1103
- if (node.type === "heading" && node.depth === depth) {
1104
- children.push({
1105
- type: "mdxJsxFlowElement",
1106
- name: "div",
1107
- attributes: [
1108
- {
1109
- type: "mdxJsxAttribute",
1110
- name: "className",
1111
- value: step
1112
- }
1113
- ],
1114
- children: [node]
1115
- });
1116
- } else {
1117
- children[children.length - 1].children.push(node);
1118
- }
1119
- }
1120
- return {
1121
- type: "mdxJsxFlowElement",
1122
- name: "div",
1123
- attributes: [
1124
- {
1125
- type: "mdxJsxAttribute",
1126
- name: "className",
1127
- value: steps
1128
- }
1129
- ],
1130
- data: {
1131
- _fd_step: true
1132
- },
1133
- children
1134
- };
1135
- }
1136
- return (tree) => {
1137
- visit6(tree, (parent) => {
1138
- if (!("children" in parent) || parent.type === "heading") return;
1139
- if (parent.data && "_fd_step" in parent.data) return "skip";
1140
- let startIdx = -1;
1141
- let i = 0;
1142
- const onEnd = () => {
1143
- if (startIdx === -1) return;
1144
- const item = {};
1145
- const nodes = parent.children.splice(
1146
- startIdx,
1147
- i - startIdx,
1148
- item
1149
- );
1150
- Object.assign(item, convertToSteps(nodes));
1151
- i = startIdx + 1;
1152
- startIdx = -1;
1153
- };
1154
- for (; i < parent.children.length; i++) {
1155
- const node = parent.children[i];
1156
- if (node.type !== "heading") continue;
1157
- if (startIdx !== -1) {
1158
- const startDepth = parent.children[startIdx].depth;
1159
- if (node.depth > startDepth) continue;
1160
- else if (node.depth < startDepth) onEnd();
1161
- }
1162
- const head = node.children.filter((c) => c.type === "text").at(0);
1163
- if (!head) {
1164
- onEnd();
1165
- continue;
1166
- }
1167
- const match = StepRegex.exec(head.value);
1168
- if (!match) {
1169
- onEnd();
1170
- continue;
1171
- }
1172
- head.value = match[2];
1173
- if (startIdx === -1) startIdx = i;
1174
- }
1175
- onEnd();
1176
- });
1177
- };
1178
- }
1179
-
1180
- // src/mdx-plugins/remark-npm.ts
1181
- import { visit as visit7 } from "unist-util-visit";
1182
- import convert from "npm-to-yarn";
1183
- var aliases = ["npm", "package-install"];
1184
- function remarkNpm({
1185
- persist = false,
1186
- packageManagers = [
1187
- { command: (cmd) => convert(cmd, "npm"), name: "npm" },
1188
- { command: (cmd) => convert(cmd, "pnpm"), name: "pnpm" },
1189
- { command: (cmd) => convert(cmd, "yarn"), name: "yarn" },
1190
- { command: (cmd) => convert(cmd, "bun"), name: "bun" }
1191
- ]
1192
- } = {}) {
1193
- return (tree) => {
1194
- visit7(tree, "code", (node) => {
1195
- if (!node.lang || !aliases.includes(node.lang)) return;
1196
- let code = node.value;
1197
- if (node.lang === "package-install" && !code.startsWith("npm") && !code.startsWith("npx")) {
1198
- code = `npm install ${code}`;
1199
- }
1200
- const options = {
1201
- persist,
1202
- tabs: [],
1203
- triggers: []
1204
- };
1205
- for (const manager of packageManagers) {
1206
- const value = manager.value ?? manager.name;
1207
- const command = manager.command(code);
1208
- if (!command || command.length === 0) continue;
1209
- options.defaultValue ??= value;
1210
- options.triggers.push({
1211
- value,
1212
- children: [{ type: "text", value: manager.name }]
1213
- });
1214
- options.tabs.push({
1215
- value,
1216
- children: [
1217
- {
1218
- type: "code",
1219
- lang: "bash",
1220
- meta: node.meta,
1221
- value: command
1222
- }
1223
- ]
1224
- });
1225
- }
1226
- Object.assign(node, generateCodeBlockTabs(options));
1227
- return "skip";
1228
- });
1229
- };
1230
- }
1231
-
1232
- // src/mdx-plugins/remark-mdx-files.ts
1233
- import { visit as visit8 } from "unist-util-visit";
1234
- function parseFileTree(code) {
1235
- const lines = code.split(/\r?\n/);
1236
- const stack = /* @__PURE__ */ new Map();
1237
- for (const line of lines) {
1238
- let depth = 0;
1239
- let name = line;
1240
- let match;
1241
- while (match = /(?:├──|│|└──)\s*/.exec(name)) {
1242
- name = name.slice(match[0].length);
1243
- depth++;
1244
- }
1245
- if (!name) continue;
1246
- const node = name.endsWith("/") ? { type: "folder", name, children: [], depth } : { type: "file", name, depth };
1247
- let parent;
1248
- for (let i = depth - 1; i >= 0 && !parent; i--) {
1249
- parent = stack.get(i);
1250
- }
1251
- stack.set(depth, node);
1252
- if (!parent) continue;
1253
- if (parent.type === "file") {
1254
- Object.assign(parent, {
1255
- type: "folder",
1256
- children: []
1257
- });
1258
- }
1259
- parent.children.push(node);
1260
- }
1261
- return stack.get(0);
1262
- }
1263
- function defaultToMDX(node, depth = 0) {
1264
- if (depth === 0) {
1265
- return {
1266
- type: "mdxJsxFlowElement",
1267
- name: "Files",
1268
- attributes: [],
1269
- children: [defaultToMDX(node, depth + 1)]
1270
- };
1271
- }
1272
- const attributes = [
1273
- { type: "mdxJsxAttribute", name: "name", value: node.name }
1274
- ];
1275
- if (node.type === "file") {
1276
- return {
1277
- type: "mdxJsxFlowElement",
1278
- attributes,
1279
- children: [],
1280
- name: "File"
1281
- };
1282
- }
1283
- attributes.push({
1284
- type: "mdxJsxAttribute",
1285
- name: "defaultOpen",
1286
- value: null
1287
- });
1288
- return {
1289
- type: "mdxJsxFlowElement",
1290
- attributes,
1291
- name: "Folder",
1292
- children: node.children.map((item) => defaultToMDX(item, depth + 1))
1293
- };
1294
- }
1295
- function remarkMdxFiles(options = {}) {
1296
- const { lang = "files", toMdx = defaultToMDX } = options;
1297
- return (tree) => {
1298
- visit8(tree, "code", (node) => {
1299
- if (node.lang !== lang || !node.value) return;
1300
- const fileTree = parseFileTree(node.value);
1301
- if (!fileTree) return;
1302
- Object.assign(node, toMdx(fileTree));
1303
- });
1304
- };
1305
- }
1306
-
1307
- // src/mdx-plugins/remark-mdx-mermaid.ts
1308
- import { visit as visit9 } from "unist-util-visit";
1309
- function toMDX(code) {
1310
- return {
1311
- type: "mdxJsxFlowElement",
1312
- name: "Mermaid",
1313
- attributes: [
1314
- {
1315
- type: "mdxJsxAttribute",
1316
- name: "chart",
1317
- value: code.trim()
1318
- }
1319
- ],
1320
- children: []
1321
- };
1322
- }
1323
- function remarkMdxMermaid(options = {}) {
1324
- const { lang = "mermaid" } = options;
1325
- return (tree) => {
1326
- visit9(tree, "code", (node) => {
1327
- if (node.lang !== lang || !node.value) return;
1328
- Object.assign(node, toMDX(node.value));
1329
- });
1330
- };
1331
- }
14
+ remarkSteps
15
+ } from "../chunk-XJ6ZQNEX.js";
16
+ import {
17
+ remarkStructure,
18
+ structure
19
+ } from "../chunk-SLIKY7GW.js";
20
+ import {
21
+ rehypeCode,
22
+ rehypeCodeDefaultOptions,
23
+ transformerIcon,
24
+ transformerTab
25
+ } from "../chunk-X2HFD5QJ.js";
26
+ import {
27
+ rehypeToc
28
+ } from "../chunk-EFVXL2PP.js";
29
+ import {
30
+ remarkAdmonition
31
+ } from "../chunk-JOXPHQ2R.js";
32
+ import {
33
+ remarkCodeTab
34
+ } from "../chunk-CH7YHH7V.js";
35
+ import {
36
+ generateCodeBlockTabs,
37
+ parseCodeBlockAttributes
38
+ } from "../chunk-TWIDBWFG.js";
39
+ import {
40
+ default as default2
41
+ } from "../chunk-ONG4RVCR.js";
42
+ import "../chunk-XN2LKXFZ.js";
43
+ import {
44
+ remarkHeading
45
+ } from "../chunk-HNZEUF6C.js";
46
+ import "../chunk-A4G5V4FQ.js";
47
+ import "../chunk-U67V476Y.js";
1332
48
  export {
1333
49
  generateCodeBlockTabs,
1334
50
  parseCodeBlockAttributes,