fumadocs-core 14.6.2 → 14.6.4

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.
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { PluggableList } from 'unified';
3
+ import { Compatible } from 'vfile';
4
+
5
+ interface TOCItemType {
6
+ title: ReactNode;
7
+ url: string;
8
+ depth: number;
9
+ }
10
+ type TableOfContents = TOCItemType[];
11
+ /**
12
+ * Get Table of Contents from markdown/mdx document (using remark)
13
+ *
14
+ * @param content - Markdown content or file
15
+ */
16
+ declare function getTableOfContents(content: Compatible): TableOfContents;
17
+ /**
18
+ * Get Table of Contents from markdown/mdx document (using remark)
19
+ *
20
+ * @param content - Markdown content or file
21
+ * @param remarkPlugins - remark plugins to be applied first
22
+ */
23
+ declare function getTableOfContents(content: Compatible, remarkPlugins: PluggableList): Promise<TableOfContents>;
24
+
25
+ export { type TableOfContents as T, type TOCItemType as a, getTableOfContents as g };
@@ -20,7 +20,7 @@ import {
20
20
  // src/mdx-plugins/rehype-code.ts
21
21
  import rehypeShikiFromHighlighter from "@shikijs/rehype/core";
22
22
 
23
- // ../../node_modules/.pnpm/shiki-transformers@1.0.1_shiki@1.24.2/node_modules/shiki-transformers/dist/index.js
23
+ // ../../node_modules/.pnpm/shiki-transformers@1.0.1_shiki@1.24.3/node_modules/shiki-transformers/dist/index.js
24
24
  var matchers = [
25
25
  [/^(<!--)(.+)(-->)$/, false],
26
26
  [/^(\/\*)(.+)(\*\/)$/, false],
@@ -1,4 +1,4 @@
1
- export { a as TOCItemType, T as TableOfContents, g as getTableOfContents } from '../get-toc-Dm1yr2Gr.js';
1
+ export { a as TOCItemType, T as TableOfContents, g as getTableOfContents } from '../get-toc-Cr2URuiP.js';
2
2
  import { N as Node, I as Item, R as Root } from '../page-tree-r8qjoUla.js';
3
3
  export { p as PageTree } from '../page-tree-r8qjoUla.js';
4
4
  export { S as SortedResult } from '../types-Ch8gnVgO.js';
@@ -7,6 +7,8 @@ import { NextRequest } from 'next/server';
7
7
  import { LoaderOutput, LoaderConfig, InferPageType } from '../source/index.js';
8
8
  export { H as HighlightOptions, c as createStyleTransformer, h as highlight } from '../shiki-CNmCR8Td.js';
9
9
  import 'react';
10
+ import 'unified';
11
+ import 'vfile';
10
12
  import '../config-inq6kP6y.js';
11
13
  import 'shiki';
12
14
  import 'shiki/themes';
@@ -9,7 +9,13 @@ import "../chunk-MLKGABMK.js";
9
9
 
10
10
  // src/server/get-toc.ts
11
11
  import { remark } from "remark";
12
- function getTableOfContents(content) {
12
+ function getTableOfContents(content, remarkPlugins) {
13
+ if (remarkPlugins) {
14
+ return remark().use(remarkPlugins).use(remarkHeading).process(content).then((result2) => {
15
+ if ("toc" in result2.data) return result2.data.toc;
16
+ return [];
17
+ });
18
+ }
13
19
  const result = remark().use(remarkHeading).processSync(content);
14
20
  if ("toc" in result.data) return result.data.toc;
15
21
  return [];
package/dist/toc.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, RefObject, AnchorHTMLAttributes } from 'react';
3
- import { T as TableOfContents } from './get-toc-Dm1yr2Gr.js';
3
+ import { T as TableOfContents } from './get-toc-Cr2URuiP.js';
4
+ import 'unified';
5
+ import 'vfile';
4
6
 
5
7
  /**
6
8
  * The estimated active heading ID
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "14.6.2",
3
+ "version": "14.6.4",
4
4
  "description": "The library for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -75,7 +75,7 @@
75
75
  "dependencies": {
76
76
  "@formatjs/intl-localematcher": "^0.5.9",
77
77
  "@orama/orama": "^2.1.1",
78
- "@shikijs/rehype": "^1.24.2",
78
+ "@shikijs/rehype": "^1.24.3",
79
79
  "github-slugger": "^2.0.0",
80
80
  "hast-util-to-estree": "^3.1.0",
81
81
  "hast-util-to-jsx-runtime": "^2.3.2",
@@ -85,7 +85,7 @@
85
85
  "remark": "^15.0.0",
86
86
  "remark-gfm": "^4.0.0",
87
87
  "scroll-into-view-if-needed": "^3.1.0",
88
- "shiki": "^1.24.2",
88
+ "shiki": "^1.24.3",
89
89
  "unist-util-visit": "^5.0.0"
90
90
  },
91
91
  "devDependencies": {
@@ -97,17 +97,18 @@
97
97
  "@types/mdast": "^4.0.3",
98
98
  "@types/negotiator": "^0.6.3",
99
99
  "@types/node": "22.10.2",
100
- "@types/react": "^19.0.1",
100
+ "@types/react": "^19.0.2",
101
101
  "@types/react-dom": "^19.0.2",
102
102
  "algoliasearch": "4.24.0",
103
103
  "mdast-util-mdx-jsx": "^3.1.3",
104
104
  "mdast-util-mdxjs-esm": "^2.0.1",
105
- "next": "^15.1.1",
105
+ "next": "^15.1.2",
106
106
  "remark-mdx": "^3.1.0",
107
107
  "remark-rehype": "^11.1.1",
108
108
  "shiki-transformers": "^1.0.1",
109
109
  "typescript": "^5.7.2",
110
110
  "unified": "^11.0.5",
111
+ "vfile": "^6.0.3",
111
112
  "eslint-config-custom": "0.0.0",
112
113
  "tsconfig": "0.0.0"
113
114
  },
@@ -1,16 +0,0 @@
1
- import { ReactNode } from 'react';
2
-
3
- interface TOCItemType {
4
- title: ReactNode;
5
- url: string;
6
- depth: number;
7
- }
8
- type TableOfContents = TOCItemType[];
9
- /**
10
- * Get Table of Contents from markdown/mdx document (using remark)
11
- *
12
- * @param content - Markdown content
13
- */
14
- declare function getTableOfContents(content: string): TableOfContents;
15
-
16
- export { type TableOfContents as T, type TOCItemType as a, getTableOfContents as g };