@vercel/geistdocs 2.15.3-canary.f771302 → 2.15.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.
Files changed (47) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
  3. package/dist/internal/mdx-to-markdown.js +0 -9
  4. package/dist/internal/page-actions-client.js +1 -1
  5. package/dist/internal/page-actions.d.ts +4 -4
  6. package/dist/internal/page-actions.d.ts.map +1 -1
  7. package/dist/internal/page-actions.js +1 -6
  8. package/dist/mdx.d.ts +25 -3
  9. package/dist/mdx.d.ts.map +1 -1
  10. package/dist/mdx.js +61 -8
  11. package/dist/mobile-docs-bar.js +1 -1
  12. package/dist/next.d.ts +1 -9
  13. package/dist/next.d.ts.map +1 -1
  14. package/dist/next.js +2 -25
  15. package/dist/pages/docs.d.ts +98 -5
  16. package/dist/pages/docs.d.ts.map +1 -1
  17. package/dist/pages/docs.js +250 -13
  18. package/dist/source-config.d.ts +1 -10
  19. package/dist/source-config.d.ts.map +1 -1
  20. package/dist/source-config.js +10 -20
  21. package/docs/agents.md +1 -1
  22. package/docs/llms.txt +1 -9
  23. package/docs/manifest.json +1 -1
  24. package/docs/pages/configuration.md +0 -8
  25. package/package.json +8 -28
  26. package/shared-theme.css +7 -1
  27. package/source-config.js +10 -24
  28. package/template/content/docs/configuration.mdx +0 -8
  29. package/template/package.json +1 -1
  30. package/dist/mdx-basic.d.ts +0 -27
  31. package/dist/mdx-basic.d.ts.map +0 -1
  32. package/dist/mdx-basic.js +0 -61
  33. package/dist/pages/docs-custom.d.ts +0 -111
  34. package/dist/pages/docs-custom.d.ts.map +0 -1
  35. package/dist/pages/docs-custom.js +0 -250
  36. package/native-mdx/LICENSE-mdxjs-rs +0 -22
  37. package/native-mdx/binaries/darwin-arm64.node +0 -0
  38. package/native-mdx/binaries/linux-x64-gnu.node +0 -0
  39. package/native-mdx/data-entry.d.mts +0 -15
  40. package/native-mdx/data-entry.mjs +0 -116
  41. package/native-mdx/data-projection.mjs +0 -205
  42. package/native-mdx/loader-data.cjs +0 -36
  43. package/native-mdx/loader-mdx.cjs +0 -9
  44. package/native-mdx/loader-mdx.mjs +0 -235
  45. package/native-mdx/native-binding.cjs +0 -25
  46. package/rehype-code-highlights.d.ts +0 -13
  47. package/rehype-code-highlights.js +0 -230
@@ -1,230 +0,0 @@
1
- import { codeToTokens, isSupportedLanguage } from "@pierre/highlights";
2
- import rehypeShikiFromHighlighter from "@shikijs/rehype/core";
3
- import {
4
- rehypeCodeDefaultOptions,
5
- transformerIcon,
6
- transformerTab,
7
- } from "fumadocs-core/mdx-plugins";
8
- import { tokensToHast, transformerDecorations } from "shiki/core";
9
-
10
- // Experimental: highlights code blocks with @pierre/highlights (hand-written
11
- // Wasm lexers) instead of Shiki's TextMate grammars, while keeping Shiki's
12
- // HAST output and transformer pipeline so Fumadocs' code block features
13
- // (titles, icons, tabs, line notation, diffs, focus) keep working.
14
-
15
- const v = (name) => `token-${name}`;
16
-
17
- // Maps Highlights' Zed token names onto the same CSS variables the Geist
18
- // Shiki theme uses (see `geistShikiTheme`), so the existing palette applies.
19
- // With a `cssVariables` palette, colors are variable suffixes: `token-keyword`
20
- // renders as `var(--shiki-token-keyword)`.
21
- export const geistHighlightsTheme = {
22
- name: "geist",
23
- appearance: "light",
24
- cssVariables: {
25
- prefix: "--shiki-",
26
- defaults: { "color-text": "inherit", "color-background": "transparent" },
27
- },
28
- style: {
29
- "editor.foreground": "color-text",
30
- "editor.background": "color-background",
31
- syntax: {
32
- comment: v("comment"),
33
- "comment.doc": v("comment"),
34
- "keyword.jsdoc": v("comment"),
35
- "type.jsdoc": v("comment"),
36
- "variable.jsdoc": v("comment"),
37
- constant: v("constant"),
38
- "constant.builtin": v("constant"),
39
- boolean: v("constant"),
40
- number: v("constant"),
41
- enum: v("constant"),
42
- "variable.special": v("constant"),
43
- function: v("function"),
44
- "function.definition": v("function"),
45
- "function.method": v("function"),
46
- constructor: v("function"),
47
- type: v("function"),
48
- "type.class": v("function"),
49
- tag: v("function"),
50
- "tag.jsx": v("function"),
51
- "tag.component.jsx": v("function"),
52
- "tag.doctype": v("function"),
53
- title: v("function"),
54
- namespace: v("function"),
55
- selector: v("function"),
56
- "selector.class": v("function"),
57
- "selector.id": v("function"),
58
- "selector.pseudo": v("function"),
59
- attribute: v("constant"),
60
- "attribute.jsx": v("constant"),
61
- "variable.parameter": v("parameter"),
62
- property: v("parameter"),
63
- "property.json_key": v("parameter"),
64
- label: v("parameter"),
65
- "text.jsx": v("parameter"),
66
- "punctuation.list_marker": v("parameter"),
67
- keyword: v("keyword"),
68
- "keyword.control": v("keyword"),
69
- "keyword.declaration": v("keyword"),
70
- "keyword.import": v("keyword"),
71
- "keyword.operator": v("keyword"),
72
- operator: v("keyword"),
73
- preproc: v("keyword"),
74
- string: v("string"),
75
- "string.escape": v("string"),
76
- "string.special": v("string"),
77
- "string.special.symbol": v("string"),
78
- "text.literal": v("string"),
79
- "string.regex": v("string-expression"),
80
- punctuation: v("punctuation"),
81
- "punctuation.bracket": v("punctuation"),
82
- "punctuation.delimiter": v("punctuation"),
83
- "punctuation.special": v("keyword"),
84
- "punctuation.markup": v("punctuation"),
85
- "punctuation.bracket.html": v("parameter"),
86
- "punctuation.bracket.jsx": v("parameter"),
87
- "punctuation.delimiter.html": v("parameter"),
88
- "punctuation.delimiter.jsx": v("parameter"),
89
- link_uri: v("link"),
90
- link_text: v("parameter"),
91
- },
92
- },
93
- };
94
-
95
- // Fenced-code names that Highlights doesn't know but Shiki users write.
96
- const LANG_ALIASES = {
97
- plaintext: "plain",
98
- txt: "plain",
99
- "": "plain",
100
- };
101
-
102
- const resolveLang = (lang) => {
103
- const name = LANG_ALIASES[lang] ?? lang ?? "plain";
104
- return isSupportedLanguage(name) ? name : "plain";
105
- };
106
-
107
- const TRAILING_NEWLINE = /\n$/;
108
-
109
- const ENFORCE_ORDER = { pre: 0, undefined: 1, post: 2 };
110
-
111
- const getTransformers = (options) => [
112
- ...[...(options.transformers ?? [])].sort(
113
- (a, b) => ENFORCE_ORDER[a.enforce] - ENFORCE_ORDER[b.enforce]
114
- ),
115
- transformerDecorations(),
116
- ];
117
-
118
- const UNSTYLED = "var(--shiki-foreground)";
119
-
120
- const tokenize = (code, options) => {
121
- const result = codeToTokens(code, {
122
- lang: resolveLang(options.lang),
123
- themes: { light: geistHighlightsTheme },
124
- defaultColor: "light",
125
- cssVariablePrefix: "--shiki-",
126
- });
127
- // Highlights colors unstyled runs with `var(--shiki-foreground)`; Shiki uses
128
- // the theme foreground, which Geist defines as `--shiki-color-text`.
129
- for (const line of result.tokens) {
130
- for (const token of line) {
131
- if (token.htmlStyle?.color === UNSTYLED) {
132
- token.htmlStyle = { ...token.htmlStyle, color: result.fg };
133
- }
134
- }
135
- }
136
- return {
137
- tokens: result.tokens,
138
- fg: result.fg,
139
- bg: result.bg,
140
- themeName: "shiki-themes geist",
141
- };
142
- };
143
-
144
- /**
145
- * A minimal Shiki highlighter: enough of the API for `@shikijs/rehype/core`.
146
- * Mirrors Shiki's `codeToHast` (preprocess → tokens → token transformers →
147
- * `tokensToHast`), swapping the tokenizer for Highlights.
148
- */
149
- export const highlightsShikiAdapter = {
150
- getLoadedLanguages: () => [],
151
- loadLanguage: async () => undefined,
152
- codeToTokens: (code, options) => tokenize(code, options),
153
- codeToHast(code, options) {
154
- const transformers = getTransformers(options);
155
- const context = {
156
- meta: {},
157
- options,
158
- codeToHast: (c, o) => highlightsShikiAdapter.codeToHast(c, o),
159
- codeToTokens: (c, o) => tokenize(c, o),
160
- };
161
-
162
- let input = code;
163
- for (const transformer of transformers) {
164
- input = transformer.preprocess?.call(context, input, options) || input;
165
- }
166
-
167
- let { tokens, fg, bg, themeName } = tokenize(input, options);
168
- const contextSource = {
169
- ...context,
170
- get source() {
171
- return input;
172
- },
173
- };
174
- for (const transformer of transformers) {
175
- tokens = transformer.tokens?.call(contextSource, tokens) || tokens;
176
- }
177
-
178
- return tokensToHast(
179
- tokens,
180
- {
181
- ...options,
182
- fg,
183
- bg,
184
- themeName,
185
- transformers: options.transformers,
186
- },
187
- contextSource
188
- );
189
- },
190
- };
191
-
192
- /** Drop-in for Fumadocs' `rehypeCode`, backed by @pierre/highlights. */
193
- export const rehypeCodeHighlights = (userOptions = {}) => {
194
- const options = { ...rehypeCodeDefaultOptions, ...userOptions };
195
- const transformers = [...(options.transformers ?? [])];
196
-
197
- // Same preprocessing as Fumadocs' rehypeCode.
198
- transformers.unshift({
199
- name: "rehype-code:pre-process",
200
- preprocess(code, { meta }) {
201
- if (meta && "__parsed_raw" in meta) {
202
- meta.__raw = meta.__parsed_raw;
203
- // biome-ignore lint/performance/noDelete: matches Fumadocs.
204
- delete meta.__parsed_raw;
205
- }
206
- if (meta && options.filterMetaString) {
207
- meta.__raw = options.filterMetaString(meta.__raw ?? "");
208
- }
209
- return code.replace(TRAILING_NEWLINE, "");
210
- },
211
- });
212
- if (options.icon !== false) {
213
- transformers.push(transformerIcon(options.icon));
214
- }
215
- if (options.tab !== false) {
216
- transformers.push(transformerTab());
217
- }
218
-
219
- // `lazy` routes every language through `loadLanguage`, which is a no-op:
220
- // Highlights bundles its lexers and unknown languages fall back to plain.
221
- const transformer = rehypeShikiFromHighlighter(highlightsShikiAdapter, {
222
- ...options,
223
- lazy: true,
224
- transformers,
225
- });
226
-
227
- return async (tree, file) => {
228
- await transformer(tree, file, () => undefined);
229
- };
230
- };