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.
- package/dist/{chunk-NJLFLPV4.js → chunk-HN2NUUD2.js} +3 -2
- package/dist/highlight/client.d.ts +1 -0
- package/dist/highlight/client.js +1 -1
- package/dist/highlight/index.d.ts +3 -1
- package/dist/highlight/index.js +5 -3
- package/dist/i18n/index.server.js +3 -3
- package/dist/mdx-plugins/index.d.ts +2 -2
- package/dist/mdx-plugins/index.js +2 -2
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ var defaultThemes = {
|
|
|
7
7
|
dark: "github-dark"
|
|
8
8
|
};
|
|
9
9
|
var highlighters = /* @__PURE__ */ new Map();
|
|
10
|
-
async function
|
|
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
|
|
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
|
};
|
package/dist/highlight/client.js
CHANGED
|
@@ -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 };
|
package/dist/highlight/index.js
CHANGED
|
@@ -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
|
-
|
|
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-
|
|
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
|
}
|