fumadocs-core 15.2.14 → 15.2.15

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.
@@ -2,19 +2,6 @@
2
2
  import { toJsxRuntime } from "hast-util-to-jsx-runtime";
3
3
  import { Fragment } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
- function createStyleTransformer() {
6
- return {
7
- name: "rehype-code:styles",
8
- line(hast) {
9
- if (hast.children.length === 0) {
10
- hast.children.push({
11
- type: "text",
12
- value: " "
13
- });
14
- }
15
- }
16
- };
17
- }
18
5
  var defaultThemes = {
19
6
  light: "github-light",
20
7
  dark: "github-dark"
@@ -37,7 +24,6 @@ async function _highlight(code, options) {
37
24
  lang,
38
25
  ...rest,
39
26
  ...themes,
40
- transformers: [createStyleTransformer(), ...rest.transformers ?? []],
41
27
  defaultColor: "themes" in themes ? false : void 0
42
28
  });
43
29
  }
@@ -88,7 +74,6 @@ async function highlight(code, options) {
88
74
  }
89
75
 
90
76
  export {
91
- createStyleTransformer,
92
77
  defaultThemes,
93
78
  _highlight,
94
79
  _renderHighlight,
@@ -3,7 +3,7 @@ import {
3
3
  _highlight,
4
4
  _renderHighlight,
5
5
  highlight
6
- } from "../chunk-SRVMHXJD.js";
6
+ } from "../chunk-KNWSJ4IF.js";
7
7
  import "../chunk-MLKGABMK.js";
8
8
 
9
9
  // src/highlight/client.tsx
@@ -1,9 +1,8 @@
1
- import { CodeToHastOptionsCommon, BundledLanguage, CodeOptionsMeta, Awaitable, RegexEngine, CodeOptionsThemes, ShikiTransformer, BundledHighlighterOptions, Highlighter } from 'shiki';
1
+ import { CodeToHastOptionsCommon, BundledLanguage, CodeOptionsMeta, Awaitable, RegexEngine, CodeOptionsThemes, BundledHighlighterOptions, Highlighter } from 'shiki';
2
2
  import { BundledTheme } from 'shiki/themes';
3
3
  import { Components } from 'hast-util-to-jsx-runtime';
4
4
  import { ReactNode } from 'react';
5
5
 
6
- declare function createStyleTransformer(): ShikiTransformer;
7
6
  type HighlightOptionsCommon = CodeToHastOptionsCommon<BundledLanguage> & CodeOptionsMeta & {
8
7
  engine?: Awaitable<RegexEngine>;
9
8
  components?: Partial<Components>;
@@ -19,4 +18,4 @@ type HighlightOptions = HighlightOptionsCommon & (HighlightOptionsThemes | Recor
19
18
  declare function getHighlighter(engineType: 'js' | 'oniguruma' | 'custom', options: BundledHighlighterOptions<BundledLanguage, BundledTheme>): Promise<Highlighter>;
20
19
  declare function highlight(code: string, options: HighlightOptions): Promise<ReactNode>;
21
20
 
22
- export { type HighlightOptions, type HighlightOptionsCommon, type HighlightOptionsThemes, createStyleTransformer, getHighlighter, highlight };
21
+ export { type HighlightOptions, type HighlightOptionsCommon, type HighlightOptionsThemes, getHighlighter, highlight };
@@ -1,11 +1,9 @@
1
1
  import {
2
- createStyleTransformer,
3
2
  getHighlighter,
4
3
  highlight
5
- } from "../chunk-SRVMHXJD.js";
4
+ } from "../chunk-KNWSJ4IF.js";
6
5
  import "../chunk-MLKGABMK.js";
7
6
  export {
8
- createStyleTransformer,
9
7
  getHighlighter,
10
8
  highlight
11
9
  };
@@ -4,7 +4,7 @@ import { RehypeShikiOptions } from '@shikijs/rehype';
4
4
  import { Processor, Transformer } from 'unified';
5
5
  import { ShikiTransformer } from 'shiki';
6
6
  import { Root as Root$1 } from 'mdast';
7
- export { a as StructureOptions, S as StructuredData, r as remarkStructure, s as structure } from '../remark-structure-FIjTA11P.js';
7
+ export { a as StructureOptions, S as StructuredData, r as remarkStructure, s as structure } from '../remark-structure-DVje0Sib.js';
8
8
  export { R as RemarkHeadingOptions, r as remarkHeading } from '../remark-heading-BPCoYwjn.js';
9
9
  import 'mdast-util-mdx-jsx';
10
10
 
@@ -7,10 +7,9 @@ import {
7
7
  slash
8
8
  } from "../chunk-XMCPKVJQ.js";
9
9
  import {
10
- createStyleTransformer,
11
10
  defaultThemes,
12
11
  getHighlighter
13
- } from "../chunk-SRVMHXJD.js";
12
+ } from "../chunk-KNWSJ4IF.js";
14
13
  import "../chunk-MLKGABMK.js";
15
14
 
16
15
  // src/mdx-plugins/index.ts
@@ -194,7 +193,6 @@ var rehypeCodeDefaultOptions = {
194
193
  defaultLanguage: "plaintext",
195
194
  experimentalJSEngine: false,
196
195
  transformers: [
197
- createStyleTransformer(),
198
196
  transformerNotationHighlight({
199
197
  matchAlgorithm: "v3"
200
198
  }),
@@ -247,7 +245,7 @@ function rehypeCode(_options = {}) {
247
245
  options.experimentalJSEngine ? "js" : "oniguruma",
248
246
  {
249
247
  themes: "themes" in options ? Object.values(options.themes).filter(Boolean) : [options.theme],
250
- langs: options.langs ?? (options.lazy ? [] : Object.keys(bundledLanguages))
248
+ langs: options.langs ?? (options.lazy ? ["ts", "tsx"] : Object.keys(bundledLanguages))
251
249
  }
252
250
  );
253
251
  const transformer = highlighter.then(
@@ -450,7 +448,10 @@ function remarkStructure({
450
448
  "tableCell",
451
449
  "mdxJsxFlowElement"
452
450
  ],
453
- allowedMdxAttributes = () => true
451
+ allowedMdxAttributes = (node) => {
452
+ if (!node.name) return false;
453
+ return ["TypeTable", "Callout"].includes(node.name);
454
+ }
454
455
  } = {}) {
455
456
  if (Array.isArray(allowedMdxAttributes)) {
456
457
  const arr = allowedMdxAttributes;
@@ -503,13 +504,13 @@ function remarkStructure({
503
504
  content: element.name
504
505
  },
505
506
  ...element.attributes.flatMap((attribute) => {
506
- const valueStr = typeof attribute.value === "string" ? attribute.value : attribute.value?.value;
507
- if (!valueStr) return [];
507
+ const value = typeof attribute.value === "string" ? attribute.value : attribute.value?.value;
508
+ if (!value || value.length === 0) return [];
508
509
  if (allowedMdxAttributes && !allowedMdxAttributes(element, attribute))
509
510
  return [];
510
511
  return {
511
512
  heading: lastHeading,
512
- content: attribute.type === "mdxJsxAttribute" ? `${attribute.name}: ${valueStr}` : valueStr
513
+ content: attribute.type === "mdxJsxAttribute" ? `${attribute.name}: ${value}` : value
513
514
  };
514
515
  })
515
516
  );
@@ -1,6 +1,6 @@
1
1
  import { Nodes, Root } from 'mdast';
2
2
  import { Transformer, PluggableList } from 'unified';
3
- import { MdxJsxAttribute, MdxJsxExpressionAttribute } from 'mdast-util-mdx-jsx';
3
+ import { MdxJsxFlowElement, MdxJsxAttribute, MdxJsxExpressionAttribute } from 'mdast-util-mdx-jsx';
4
4
 
5
5
  interface Heading {
6
6
  id: string;
@@ -24,7 +24,13 @@ interface StructureOptions {
24
24
  * @defaultValue ['heading', 'paragraph', 'blockquote', 'tableCell', 'mdxJsxFlowElement']
25
25
  */
26
26
  types?: string[] | ((node: Nodes) => boolean);
27
- allowedMdxAttributes?: string[] | ((node: Nodes, attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => boolean);
27
+ /**
28
+ * A list of indexable MDX attributes, either:
29
+ *
30
+ * - an array of attribute names.
31
+ * - a function that determines if attribute should be indexed.
32
+ */
33
+ allowedMdxAttributes?: string[] | ((node: MdxJsxFlowElement, attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => boolean);
28
34
  }
29
35
  declare module 'mdast' {
30
36
  interface Data {
@@ -1,5 +1,5 @@
1
1
  import { SearchClient, SearchIndex } from 'algoliasearch';
2
- import { S as StructuredData } from '../remark-structure-FIjTA11P.js';
2
+ import { S as StructuredData } from '../remark-structure-DVje0Sib.js';
3
3
  import 'mdast';
4
4
  import 'unified';
5
5
  import 'mdast-util-mdx-jsx';
@@ -2,7 +2,7 @@ import { S as SortedResult } from '../types-Ch8gnVgO.js';
2
2
  import { AnyOrama } from '@orama/orama';
3
3
  import { SearchOptions } from '@algolia/client-search';
4
4
  import { SearchIndex } from 'algoliasearch/lite';
5
- import '../remark-structure-FIjTA11P.js';
5
+ import '../remark-structure-DVje0Sib.js';
6
6
  import { OramaClient, ClientSearchParams } from '@oramacloud/client';
7
7
  import 'mdast';
8
8
  import 'unified';
@@ -1,5 +1,5 @@
1
1
  import { CloudManager } from '@oramacloud/client';
2
- import { S as StructuredData } from '../remark-structure-FIjTA11P.js';
2
+ import { S as StructuredData } from '../remark-structure-DVje0Sib.js';
3
3
  import '../remark-heading-BPCoYwjn.js';
4
4
  import 'mdast';
5
5
  import 'unified';
@@ -1,5 +1,5 @@
1
1
  import { TypedDocument, Orama, Language, RawData, create, SearchParams } from '@orama/orama';
2
- import { S as StructuredData } from '../remark-structure-FIjTA11P.js';
2
+ import { S as StructuredData } from '../remark-structure-DVje0Sib.js';
3
3
  import { S as SortedResult } from '../types-Ch8gnVgO.js';
4
4
  import { I as I18nConfig } from '../config-Cm58P4fz.js';
5
5
  import { LoaderOutput, LoaderConfig, InferPageType } from '../source/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "15.2.14",
3
+ "version": "15.2.15",
4
4
  "description": "The library for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -115,8 +115,8 @@
115
115
  "typescript": "^5.8.3",
116
116
  "unified": "^11.0.5",
117
117
  "vfile": "^6.0.3",
118
- "eslint-config-custom": "0.0.0",
119
- "tsconfig": "0.0.0"
118
+ "tsconfig": "0.0.0",
119
+ "eslint-config-custom": "0.0.0"
120
120
  },
121
121
  "peerDependencies": {
122
122
  "@oramacloud/client": "1.x.x || 2.x.x",