fumadocs-core 16.0.8 → 16.0.10

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.
@@ -1,9 +1,9 @@
1
- import {
2
- findPath
3
- } from "./chunk-IZPLHEX4.js";
4
1
  import {
5
2
  normalizeUrl
6
3
  } from "./chunk-PFNP6PEB.js";
4
+ import {
5
+ findPath
6
+ } from "./chunk-IZPLHEX4.js";
7
7
  import "./chunk-U67V476Y.js";
8
8
 
9
9
  // src/breadcrumb.tsx
@@ -0,0 +1,74 @@
1
+ // src/mdx-plugins/remark-directive-admonition.ts
2
+ import { visit } from "unist-util-visit";
3
+ function remarkDirectiveAdmonition({
4
+ tags: {
5
+ CalloutContainer = "CalloutContainer",
6
+ CalloutTitle = "CalloutTitle",
7
+ CalloutDescription = "CalloutDescription"
8
+ } = {},
9
+ types = {
10
+ note: "info",
11
+ tip: "info",
12
+ info: "info",
13
+ warn: "warning",
14
+ warning: "warning",
15
+ danger: "error",
16
+ success: "success"
17
+ }
18
+ } = {}) {
19
+ return (tree) => {
20
+ visit(tree, "containerDirective", (node) => {
21
+ if (!(node.name in types)) return;
22
+ const attributes = [
23
+ {
24
+ type: "mdxJsxAttribute",
25
+ name: "type",
26
+ value: types[node.name]
27
+ }
28
+ ];
29
+ for (const [k, v] of Object.entries(node.attributes ?? {})) {
30
+ attributes.push({
31
+ type: "mdxJsxAttribute",
32
+ name: k,
33
+ value: v
34
+ });
35
+ }
36
+ const titleNodes = [];
37
+ const descriptionNodes = [];
38
+ for (const item of node.children) {
39
+ if (item.type === "paragraph" && item.data?.directiveLabel) {
40
+ titleNodes.push(...item.children);
41
+ } else {
42
+ descriptionNodes.push(item);
43
+ }
44
+ }
45
+ const children = [];
46
+ if (titleNodes.length > 0) {
47
+ children.push({
48
+ type: "mdxJsxFlowElement",
49
+ name: CalloutTitle,
50
+ attributes: [],
51
+ children: titleNodes
52
+ });
53
+ }
54
+ if (descriptionNodes.length > 0) {
55
+ children.push({
56
+ type: "mdxJsxFlowElement",
57
+ name: CalloutDescription,
58
+ attributes: [],
59
+ children: descriptionNodes
60
+ });
61
+ }
62
+ Object.assign(node, {
63
+ type: "mdxJsxFlowElement",
64
+ attributes,
65
+ name: CalloutContainer,
66
+ children
67
+ });
68
+ });
69
+ };
70
+ }
71
+
72
+ export {
73
+ remarkDirectiveAdmonition
74
+ };
@@ -1,8 +1,6 @@
1
1
  // src/mdx-plugins/remark-image.ts
2
2
  import * as path from "path";
3
3
  import { visit } from "unist-util-visit";
4
- import { imageSize } from "image-size";
5
- import { imageSizeFromFile } from "image-size/fromFile";
6
4
  import { fileURLToPath } from "url";
7
5
  var VALID_BLUR_EXT = [".jpeg", ".png", ".webp", ".avif", ".jpg"];
8
6
  var EXTERNAL_URL_REGEX = /^https?:\/\//;
@@ -195,7 +193,10 @@ function parseSrc(src, publicDir, dir) {
195
193
  };
196
194
  }
197
195
  async function getImageSize(src, onExternal) {
198
- if (src.type === "file") return imageSizeFromFile(src.file);
196
+ if (src.type === "file") {
197
+ const { imageSizeFromFile } = await import("image-size/fromFile");
198
+ return imageSizeFromFile(src.file);
199
+ }
199
200
  if (onExternal === false) return;
200
201
  const { timeout } = typeof onExternal === "object" ? onExternal : {};
201
202
  const res = await fetch(src.url, {
@@ -206,6 +207,7 @@ async function getImageSize(src, onExternal) {
206
207
  `[Remark Image] Failed to fetch ${src.url} (${res.status}): ${await res.text()}`
207
208
  );
208
209
  }
210
+ const { imageSize } = await import("image-size");
209
211
  return imageSize(new Uint8Array(await res.arrayBuffer()));
210
212
  }
211
213
 
@@ -4,6 +4,7 @@ export { RemarkImageOptions, remarkImage } from './remark-image.js';
4
4
  export { StructureOptions, StructuredData, remarkStructure, structure } from './remark-structure.js';
5
5
  export { RemarkHeadingOptions, remarkHeading } from './remark-heading.js';
6
6
  export { RemarkAdmonitionOptions, remarkAdmonition } from './remark-admonition.js';
7
+ export { RemarkDirectiveAdmonitionOptions, remarkDirectiveAdmonition } from './remark-directive-admonition.js';
7
8
  export { RehypeTocOptions, rehypeToc } from './rehype-toc.js';
8
9
  export { RemarkCodeTabOptions, remarkCodeTab } from './remark-code-tab.js';
9
10
  export { RemarkStepsOptions, remarkSteps } from './remark-steps.js';
@@ -1,6 +1,9 @@
1
+ import {
2
+ default as default2
3
+ } from "../chunk-ONG4RVCR.js";
1
4
  import {
2
5
  remarkImage
3
- } from "../chunk-VW3XKOZZ.js";
6
+ } from "../chunk-YDNO7UZ6.js";
4
7
  import {
5
8
  remarkMdxFiles
6
9
  } from "../chunk-ADBHPKXG.js";
@@ -37,8 +40,8 @@ import {
37
40
  parseCodeBlockAttributes
38
41
  } from "../chunk-TWIDBWFG.js";
39
42
  import {
40
- default as default2
41
- } from "../chunk-ONG4RVCR.js";
43
+ remarkDirectiveAdmonition
44
+ } from "../chunk-APKPSBSB.js";
42
45
  import "../chunk-XN2LKXFZ.js";
43
46
  import {
44
47
  remarkHeading
@@ -53,6 +56,7 @@ export {
53
56
  rehypeToc,
54
57
  remarkAdmonition,
55
58
  remarkCodeTab,
59
+ remarkDirectiveAdmonition,
56
60
  default2 as remarkGfm,
57
61
  remarkHeading,
58
62
  remarkImage,
@@ -12,6 +12,8 @@ interface RemarkAdmonitionOptions {
12
12
  * Remark Plugin to support Admonition syntax
13
13
  *
14
14
  * Useful when Migrating from Docusaurus
15
+ *
16
+ * @deprecated Use `remarkDirectiveAdmonition` with `remark-directive` configured instead.
15
17
  */
16
18
  declare function remarkAdmonition(options?: RemarkAdmonitionOptions): Transformer<Root, Root>;
17
19
 
@@ -0,0 +1,27 @@
1
+ import { Root } from 'mdast';
2
+ import { Transformer } from 'unified';
3
+
4
+ interface RemarkDirectiveAdmonitionOptions {
5
+ /**
6
+ * the tag names of Callout component.
7
+ */
8
+ tags?: {
9
+ CalloutContainer?: string;
10
+ CalloutTitle?: string;
11
+ CalloutDescription?: string;
12
+ };
13
+ /**
14
+ * All supported admonition types and their linked Callout type.
15
+ *
16
+ * When specified, all defaults will be cleared.
17
+ */
18
+ types?: Record<string, string>;
19
+ }
20
+ /**
21
+ * Remark Plugin to support Admonition syntax in Docusaurus, useful for migrating from Docusaurus.
22
+ *
23
+ * Requires [`remark-directive`](https://github.com/remarkjs/remark-directive) to be configured.
24
+ */
25
+ declare function remarkDirectiveAdmonition({ tags: { CalloutContainer, CalloutTitle, CalloutDescription, }, types, }?: RemarkDirectiveAdmonitionOptions): Transformer<Root, Root>;
26
+
27
+ export { type RemarkDirectiveAdmonitionOptions, remarkDirectiveAdmonition };
@@ -0,0 +1,7 @@
1
+ import {
2
+ remarkDirectiveAdmonition
3
+ } from "../chunk-APKPSBSB.js";
4
+ import "../chunk-U67V476Y.js";
5
+ export {
6
+ remarkDirectiveAdmonition
7
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  remarkImage
3
- } from "../chunk-VW3XKOZZ.js";
3
+ } from "../chunk-YDNO7UZ6.js";
4
4
  import "../chunk-U67V476Y.js";
5
5
  export {
6
6
  remarkImage
@@ -55,7 +55,6 @@ async function searchDocs(query, options) {
55
55
  ...extraParams?.where
56
56
  }),
57
57
  groupBy: {
58
- // TODO: this was causing error on number of group variants
59
58
  properties: ["page_id"],
60
59
  max_results: 7,
61
60
  ...extraParams?.groupBy
@@ -66,7 +66,7 @@ function useDocsSearch(clientOptions) {
66
66
  return searchDocs(debouncedValue, client);
67
67
  }
68
68
  if (client.type === "orama-cloud") {
69
- const { searchDocs } = await import("../orama-cloud-WEGQE5A6.js");
69
+ const { searchDocs } = await import("../orama-cloud-UZAPMPFV.js");
70
70
  return searchDocs(debouncedValue, client);
71
71
  }
72
72
  if (client.type === "static") {
@@ -1,3 +1,7 @@
1
+ import {
2
+ basename,
3
+ extname
4
+ } from "../chunk-XZSI7AHE.js";
1
5
  import {
2
6
  searchAdvanced,
3
7
  searchSimple
@@ -6,10 +10,6 @@ import "../chunk-ZMWYLUDP.js";
6
10
  import {
7
11
  createContentHighlighter
8
12
  } from "../chunk-OTD7MV33.js";
9
- import {
10
- basename,
11
- extname
12
- } from "../chunk-XZSI7AHE.js";
13
13
  import {
14
14
  findPath
15
15
  } from "../chunk-IZPLHEX4.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "16.0.8",
3
+ "version": "16.0.10",
4
4
  "description": "The library for building a documentation website in any React.js framework",
5
5
  "keywords": [
6
6
  "Fumadocs",
@@ -142,6 +142,7 @@
142
142
  "mdast-util-mdxjs-esm": "^2.0.1",
143
143
  "next": "16.0.1",
144
144
  "react-router": "^7.9.5",
145
+ "remark-directive": "^4.0.0",
145
146
  "remark-mdx": "^3.1.1",
146
147
  "remove-markdown": "^0.6.2",
147
148
  "typescript": "^5.9.3",