fumadocs-core 15.7.8 → 15.7.9

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.
@@ -7,7 +7,7 @@ var defaultThemes = {
7
7
  dark: "github-dark"
8
8
  };
9
9
  var highlighters = /* @__PURE__ */ new Map();
10
- async function _highlight(code, options) {
10
+ async function highlightHast(code, options) {
11
11
  const {
12
12
  lang: initialLang,
13
13
  fallbackLanguage,
@@ -101,11 +101,12 @@ async function getHighlighter(engineType, options) {
101
101
  });
102
102
  }
103
103
  async function highlight(code, options) {
104
- return _renderHighlight(await _highlight(code, options), options);
104
+ return _renderHighlight(await highlightHast(code, options), options);
105
105
  }
106
106
 
107
107
  export {
108
108
  defaultThemes,
109
+ highlightHast,
109
110
  getHighlighter,
110
111
  highlight
111
112
  };
@@ -3,6 +3,7 @@ import { HighlightOptions } from './index.js';
3
3
  import 'shiki';
4
4
  import 'shiki/themes';
5
5
  import 'hast-util-to-jsx-runtime';
6
+ import 'hast';
6
7
 
7
8
  declare function useShiki(code: string, options: HighlightOptions & {
8
9
  /**
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  highlight
4
- } from "../chunk-NJLFLPV4.js";
4
+ } from "../chunk-HN2NUUD2.js";
5
5
  import "../chunk-JSBRDJBE.js";
6
6
 
7
7
  // src/highlight/client.tsx
@@ -2,6 +2,7 @@ import { CodeToHastOptionsCommon, BundledLanguage, CodeOptionsMeta, Awaitable, R
2
2
  import { BundledTheme } from 'shiki/themes';
3
3
  import { Components } from 'hast-util-to-jsx-runtime';
4
4
  import { ReactNode } from 'react';
5
+ import { Root } from 'hast';
5
6
 
6
7
  type HighlightOptionsCommon = CodeToHastOptionsCommon<BundledLanguage> & CodeOptionsMeta & {
7
8
  engine?: 'js' | 'oniguruma' | Awaitable<RegexEngine>;
@@ -10,6 +11,7 @@ type HighlightOptionsCommon = CodeToHastOptionsCommon<BundledLanguage> & CodeOpt
10
11
  };
11
12
  type HighlightOptionsThemes = CodeOptionsThemes<BundledTheme>;
12
13
  type HighlightOptions = HighlightOptionsCommon & (HighlightOptionsThemes | Record<never, never>);
14
+ declare function highlightHast(code: string, options: HighlightOptions): Promise<Root>;
13
15
  /**
14
16
  * Get Shiki highlighter instance of Fumadocs (mostly for internal use, don't recommend you to use it).
15
17
  *
@@ -19,4 +21,4 @@ type HighlightOptions = HighlightOptionsCommon & (HighlightOptionsThemes | Recor
19
21
  declare function getHighlighter(engineType: 'js' | 'oniguruma' | 'custom', options: BundledHighlighterOptions<BundledLanguage, BundledTheme>): Promise<Highlighter>;
20
22
  declare function highlight(code: string, options: HighlightOptions): Promise<ReactNode>;
21
23
 
22
- export { type HighlightOptions, type HighlightOptionsCommon, type HighlightOptionsThemes, getHighlighter, highlight };
24
+ export { type HighlightOptions, type HighlightOptionsCommon, type HighlightOptionsThemes, getHighlighter, highlight, highlightHast };
@@ -1,9 +1,11 @@
1
1
  import {
2
2
  getHighlighter,
3
- highlight
4
- } from "../chunk-NJLFLPV4.js";
3
+ highlight,
4
+ highlightHast
5
+ } from "../chunk-HN2NUUD2.js";
5
6
  import "../chunk-JSBRDJBE.js";
6
7
  export {
7
8
  getHighlighter,
8
- highlight
9
+ highlight,
10
+ highlightHast
9
11
  };
@@ -1,9 +1,9 @@
1
- import {
2
- createI18nMiddleware
3
- } from "../chunk-KLUGJRZC.js";
4
1
  import {
5
2
  defineI18n
6
3
  } from "../chunk-HUTQC33E.js";
4
+ import {
5
+ createI18nMiddleware
6
+ } from "../chunk-KLUGJRZC.js";
7
7
  import "../chunk-JSBRDJBE.js";
8
8
  export {
9
9
  createI18nMiddleware,
@@ -8,11 +8,11 @@ export { a as StructureOptions, S as StructuredData, r as remarkStructure, s as
8
8
  export { a as RemarkCodeTabOptions, R as RemarkHeadingOptions, b as remarkCodeTab, r as remarkHeading } from '../remark-code-tab-DmyIyi6m.js';
9
9
  import { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
10
10
 
11
- interface CodeBlockIcon {
11
+ type CodeBlockIcon = {
12
12
  viewBox: string;
13
13
  fill: string;
14
14
  d: string;
15
- }
15
+ } | string;
16
16
  interface IconOptions {
17
17
  shortcuts?: Record<string, string>;
18
18
  extend?: Record<string, CodeBlockIcon>;
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  defaultThemes,
7
7
  getHighlighter
8
- } from "../chunk-NJLFLPV4.js";
8
+ } from "../chunk-HN2NUUD2.js";
9
9
  import "../chunk-JSBRDJBE.js";
10
10
 
11
11
  // src/mdx-plugins/index.ts
@@ -161,7 +161,7 @@ function transformerIcon(options = {}) {
161
161
  const iconName = lang in shortcuts ? shortcuts[lang] : lang;
162
162
  const icon = iconName in icons ? icons[iconName] : defaultIcon;
163
163
  if (icon) {
164
- pre.properties.icon = `<svg viewBox="${icon.viewBox}"><path d="${icon.d}" fill="${icon.fill}" /></svg>`;
164
+ pre.properties.icon = typeof icon === "string" ? icon : `<svg viewBox="${icon.viewBox}"><path d="${icon.d}" fill="${icon.fill}" /></svg>`;
165
165
  }
166
166
  return pre;
167
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "15.7.8",
3
+ "version": "15.7.9",
4
4
  "description": "The library for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",