nimbus-docs 0.1.3 → 0.1.5

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/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
+ import { a as SeverityConfig, r as RuleCode } from "./diagnostic-DZf0z79l.js";
1
2
  import { BadgeVariant, Breadcrumb, NimbusConfig, PrevNext, PrevNextLink, PrevNextOverrides, ResolvedVersions, SearchProvider, SearchResult, SidebarBadge, SidebarConfig, SidebarConfigItem, SidebarExternalLinkItem, SidebarGroupItem, SidebarItem, SidebarLinkItem, SidebarSection, TOCItem, VersionAlternateRecord, VersionAlternatesTable, VersionPageRef, VersionStatus, VersionsConfig } from "./types.js";
2
3
  import mdx from "@astrojs/mdx";
3
4
  import * as astro_content0 from "astro:content";
4
5
  import { CollectionEntry } from "astro:content";
5
6
  import { AstroGlobal, AstroIntegration, GetStaticPaths } from "astro";
6
- import { ShikiTransformer } from "shiki";
7
7
 
8
8
  //#region src/_internal/content.d.ts
9
9
  /**
@@ -63,6 +63,24 @@ interface MarkdownEntry {
63
63
  */
64
64
  declare function renderEntryAsMarkdown(entry: MarkdownEntry, options?: RenderEntryAsMarkdownOptions): string;
65
65
  //#endregion
66
+ //#region src/lint/config.d.ts
67
+ /** A single rule's config: a bare severity, or `[severity, options]`. */
68
+ type RuleSetting = SeverityConfig | [SeverityConfig, Record<string, unknown>];
69
+ /** The `rules` option: code → setting. An empty object = all rules on. */
70
+ type RulesConfig = Partial<Record<RuleCode, RuleSetting>>;
71
+ /** Per-collection lint config — currently just `rules` overrides. */
72
+ interface CollectionLintConfig {
73
+ rules?: RulesConfig;
74
+ }
75
+ /**
76
+ * The `collections` option: collection name → per-collection overrides.
77
+ * Each entry's `rules` shallow-merges over the top-level `rules` for
78
+ * files in that collection. Per-rule resolution precedence is:
79
+ * top-level defaults → per-collection → per-file `nimbusDisableRules`
80
+ * → per-line inline disable. Each layer narrows scope.
81
+ */
82
+ type CollectionsConfig = Record<string, CollectionLintConfig>;
83
+ //#endregion
66
84
  //#region src/integration.d.ts
67
85
  interface NimbusIntegrationOptions {
68
86
  /** MDX options forwarded to `@astrojs/mdx`. */
@@ -93,9 +111,949 @@ interface NimbusIntegrationOptions {
93
111
  contentDirs?: string[];
94
112
  skip?: (filePath: string) => boolean;
95
113
  };
114
+ /**
115
+ * Authoring-lint severity overrides for `nimbus-docs lint`. Maps a rule
116
+ * code to `"error" | "warn" | "off"` or a `[severity, options]` tuple.
117
+ * Build validators are rejected here — they have no severity knob.
118
+ * Omitted = every authoring rule on at `error`.
119
+ *
120
+ * These are materialized to `.nimbus/lint.json` at config setup so the
121
+ * standalone `nimbus-docs lint` CLI can read them. The build itself is
122
+ * never gated on authoring rules.
123
+ */
124
+ rules?: RulesConfig;
125
+ /**
126
+ * Per-collection overrides. Each entry's `rules` block shallow-merges
127
+ * over the top-level `rules` for files in that collection — same shape,
128
+ * same validation, same build-validator carve-out (build validators
129
+ * stay global, they can't be configured per-collection).
130
+ *
131
+ * @example
132
+ * collections: {
133
+ * partials: { rules: { "nimbus/single-h1": "off", "nimbus/heading-hierarchy": "off" } },
134
+ * }
135
+ */
136
+ collections?: CollectionsConfig;
96
137
  }
97
138
  declare function nimbus(rawConfig: NimbusConfig, options?: NimbusIntegrationOptions): AstroIntegration;
98
139
  //#endregion
140
+ //#region ../../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts
141
+ // ## Interfaces
142
+ /**
143
+ * Info associated with nodes by the ecosystem.
144
+ *
145
+ * This space is guaranteed to never be specified by unist or specifications
146
+ * implementing unist.
147
+ * But you can use it in utilities and plugins to store data.
148
+ *
149
+ * This type can be augmented to register custom data.
150
+ * For example:
151
+ *
152
+ * ```ts
153
+ * declare module 'unist' {
154
+ * interface Data {
155
+ * // `someNode.data.myId` is typed as `number | undefined`
156
+ * myId?: number | undefined
157
+ * }
158
+ * }
159
+ * ```
160
+ */
161
+ interface Data$1 {}
162
+ /**
163
+ * One place in a source file.
164
+ */
165
+ interface Point {
166
+ /**
167
+ * Line in a source file (1-indexed integer).
168
+ */
169
+ line: number;
170
+ /**
171
+ * Column in a source file (1-indexed integer).
172
+ */
173
+ column: number;
174
+ /**
175
+ * Character in a source file (0-indexed integer).
176
+ */
177
+ offset?: number | undefined;
178
+ }
179
+ /**
180
+ * Position of a node in a source document.
181
+ *
182
+ * A position is a range between two points.
183
+ */
184
+ interface Position$1 {
185
+ /**
186
+ * Place of the first character of the parsed source region.
187
+ */
188
+ start: Point;
189
+ /**
190
+ * Place of the first character after the parsed source region.
191
+ */
192
+ end: Point;
193
+ }
194
+ /**
195
+ * Abstract unist node.
196
+ *
197
+ * The syntactic unit in unist syntax trees are called nodes.
198
+ *
199
+ * This interface is supposed to be extended.
200
+ * If you can use {@link Literal} or {@link Parent}, you should.
201
+ * But for example in markdown, a `thematicBreak` (`***`), is neither literal
202
+ * nor parent, but still a node.
203
+ */
204
+ interface Node$1 {
205
+ /**
206
+ * Node type.
207
+ */
208
+ type: string;
209
+ /**
210
+ * Info from the ecosystem.
211
+ */
212
+ data?: Data$1 | undefined;
213
+ /**
214
+ * Position of a node in a source document.
215
+ *
216
+ * Nodes that are generated (not in the original source document) must not
217
+ * have a position.
218
+ */
219
+ position?: Position$1 | undefined;
220
+ }
221
+ //#endregion
222
+ //#region ../../node_modules/.pnpm/@types+hast@3.0.4/node_modules/@types/hast/index.d.ts
223
+ // ## Interfaces
224
+ /**
225
+ * Info associated with hast nodes by the ecosystem.
226
+ *
227
+ * This space is guaranteed to never be specified by unist or hast.
228
+ * But you can use it in utilities and plugins to store data.
229
+ *
230
+ * This type can be augmented to register custom data.
231
+ * For example:
232
+ *
233
+ * ```ts
234
+ * declare module 'hast' {
235
+ * interface Data {
236
+ * // `someNode.data.myId` is typed as `number | undefined`
237
+ * myId?: number | undefined
238
+ * }
239
+ * }
240
+ * ```
241
+ */
242
+ interface Data extends Data$1 {}
243
+ /**
244
+ * Info associated with an element.
245
+ */
246
+ interface Properties {
247
+ [PropertyName: string]: boolean | number | string | null | undefined | Array<string | number>;
248
+ }
249
+ // ## Content maps
250
+ /**
251
+ * Union of registered hast nodes that can occur in {@link Element}.
252
+ *
253
+ * To register mote custom hast nodes, add them to {@link ElementContentMap}.
254
+ * They will be automatically added here.
255
+ */
256
+ type ElementContent = ElementContentMap[keyof ElementContentMap];
257
+ /**
258
+ * Registry of all hast nodes that can occur as children of {@link Element}.
259
+ *
260
+ * For a union of all {@link Element} children, see {@link ElementContent}.
261
+ */
262
+ interface ElementContentMap {
263
+ comment: Comment;
264
+ element: Element;
265
+ text: Text;
266
+ }
267
+ /**
268
+ * Union of registered hast nodes that can occur in {@link Root}.
269
+ *
270
+ * To register custom hast nodes, add them to {@link RootContentMap}.
271
+ * They will be automatically added here.
272
+ */
273
+ type RootContent = RootContentMap[keyof RootContentMap];
274
+ /**
275
+ * Registry of all hast nodes that can occur as children of {@link Root}.
276
+ *
277
+ * > 👉 **Note**: {@link Root} does not need to be an entire document.
278
+ * > it can also be a fragment.
279
+ *
280
+ * For a union of all {@link Root} children, see {@link RootContent}.
281
+ */
282
+ interface RootContentMap {
283
+ comment: Comment;
284
+ doctype: Doctype;
285
+ element: Element;
286
+ text: Text;
287
+ }
288
+ // ## Abstract nodes
289
+ /**
290
+ * Abstract hast node.
291
+ *
292
+ * This interface is supposed to be extended.
293
+ * If you can use {@link Literal} or {@link Parent}, you should.
294
+ * But for example in HTML, a `Doctype` is neither literal nor parent, but
295
+ * still a node.
296
+ *
297
+ * To register custom hast nodes, add them to {@link RootContentMap} and other
298
+ * places where relevant (such as {@link ElementContentMap}).
299
+ *
300
+ * For a union of all registered hast nodes, see {@link Nodes}.
301
+ */
302
+ interface Node extends Node$1 {
303
+ /**
304
+ * Info from the ecosystem.
305
+ */
306
+ data?: Data | undefined;
307
+ }
308
+ /**
309
+ * Abstract hast node that contains the smallest possible value.
310
+ *
311
+ * This interface is supposed to be extended if you make custom hast nodes.
312
+ *
313
+ * For a union of all registered hast literals, see {@link Literals}.
314
+ */
315
+ interface Literal extends Node {
316
+ /**
317
+ * Plain-text value.
318
+ */
319
+ value: string;
320
+ }
321
+ /**
322
+ * Abstract hast node that contains other hast nodes (*children*).
323
+ *
324
+ * This interface is supposed to be extended if you make custom hast nodes.
325
+ *
326
+ * For a union of all registered hast parents, see {@link Parents}.
327
+ */
328
+ interface Parent extends Node {
329
+ /**
330
+ * List of children.
331
+ */
332
+ children: RootContent[];
333
+ }
334
+ // ## Concrete nodes
335
+ /**
336
+ * HTML comment.
337
+ */
338
+ interface Comment extends Literal {
339
+ /**
340
+ * Node type of HTML comments in hast.
341
+ */
342
+ type: "comment";
343
+ /**
344
+ * Data associated with the comment.
345
+ */
346
+ data?: CommentData | undefined;
347
+ }
348
+ /**
349
+ * Info associated with hast comments by the ecosystem.
350
+ */
351
+ interface CommentData extends Data {}
352
+ /**
353
+ * HTML document type.
354
+ */
355
+ interface Doctype extends Node$1 {
356
+ /**
357
+ * Node type of HTML document types in hast.
358
+ */
359
+ type: "doctype";
360
+ /**
361
+ * Data associated with the doctype.
362
+ */
363
+ data?: DoctypeData | undefined;
364
+ }
365
+ /**
366
+ * Info associated with hast doctypes by the ecosystem.
367
+ */
368
+ interface DoctypeData extends Data {}
369
+ /**
370
+ * HTML element.
371
+ */
372
+ interface Element extends Parent {
373
+ /**
374
+ * Node type of elements.
375
+ */
376
+ type: "element";
377
+ /**
378
+ * Tag name (such as `'body'`) of the element.
379
+ */
380
+ tagName: string;
381
+ /**
382
+ * Info associated with the element.
383
+ */
384
+ properties: Properties;
385
+ /**
386
+ * Children of element.
387
+ */
388
+ children: ElementContent[];
389
+ /**
390
+ * When the `tagName` field is `'template'`, a `content` field can be
391
+ * present.
392
+ */
393
+ content?: Root | undefined;
394
+ /**
395
+ * Data associated with the element.
396
+ */
397
+ data?: ElementData | undefined;
398
+ }
399
+ /**
400
+ * Info associated with hast elements by the ecosystem.
401
+ */
402
+ interface ElementData extends Data {}
403
+ /**
404
+ * Document fragment or a whole document.
405
+ *
406
+ * Should be used as the root of a tree and must not be used as a child.
407
+ *
408
+ * Can also be used as the value for the content field on a `'template'` element.
409
+ */
410
+ interface Root extends Parent {
411
+ /**
412
+ * Node type of hast root.
413
+ */
414
+ type: "root";
415
+ /**
416
+ * Children of root.
417
+ */
418
+ children: RootContent[];
419
+ /**
420
+ * Data associated with the hast root.
421
+ */
422
+ data?: RootData | undefined;
423
+ }
424
+ /**
425
+ * Info associated with hast root nodes by the ecosystem.
426
+ */
427
+ interface RootData extends Data {}
428
+ /**
429
+ * HTML character data (plain text).
430
+ */
431
+ interface Text extends Literal {
432
+ /**
433
+ * Node type of HTML character data (plain text) in hast.
434
+ */
435
+ type: "text";
436
+ /**
437
+ * Data associated with the text.
438
+ */
439
+ data?: TextData | undefined;
440
+ }
441
+ /**
442
+ * Info associated with hast texts by the ecosystem.
443
+ */
444
+ interface TextData extends Data {}
445
+ //#endregion
446
+ //#region ../../node_modules/.pnpm/@shikijs+vscode-textmate@10.0.2/node_modules/@shikijs/vscode-textmate/dist/index.d.ts
447
+ /**
448
+ * An expression language of ScopePathStr with a binary comma (to indicate alternatives) operator.
449
+ * Examples: `foo.bar boo.baz,quick quack`
450
+ */
451
+ type ScopePattern = string;
452
+ /**
453
+ * A TextMate theme.
454
+ */
455
+ interface IRawTheme {
456
+ readonly name?: string;
457
+ readonly settings: IRawThemeSetting[];
458
+ }
459
+ /**
460
+ * A single theme setting.
461
+ */
462
+ interface IRawThemeSetting {
463
+ readonly name?: string;
464
+ readonly scope?: ScopePattern | ScopePattern[];
465
+ readonly settings: {
466
+ readonly fontStyle?: string;
467
+ readonly foreground?: string;
468
+ readonly background?: string;
469
+ };
470
+ }
471
+ declare const enum FontStyle {
472
+ NotSet = -1,
473
+ None = 0,
474
+ Italic = 1,
475
+ Bold = 2,
476
+ Underline = 4,
477
+ Strikethrough = 8
478
+ }
479
+ /**
480
+ * **IMPORTANT** - Immutable!
481
+ */
482
+ interface StateStack {
483
+ _stackElementBrand: void;
484
+ readonly depth: number;
485
+ clone(): StateStack;
486
+ equals(other: StateStack): boolean;
487
+ }
488
+ //#endregion
489
+ //#region ../../node_modules/.pnpm/@shikijs+types@4.1.0/node_modules/@shikijs/types/dist/index.d.mts
490
+ interface Nothing {}
491
+ /**
492
+ * type StringLiteralUnion<'foo'> = 'foo' | string
493
+ * This has auto completion whereas `'foo' | string` doesn't
494
+ * Adapted from https://github.com/microsoft/TypeScript/issues/29729
495
+ */
496
+ type StringLiteralUnion<T extends U, U = string> = T | (U & Nothing); //#endregion
497
+ //#region src/engines.d.ts
498
+ //#endregion
499
+ //#region src/langs.d.ts
500
+ type PlainTextLanguage = 'text' | 'plaintext' | 'txt' | 'plain';
501
+ type AnsiLanguage = 'ansi';
502
+ type SpecialLanguage = PlainTextLanguage | AnsiLanguage;
503
+ //#endregion
504
+ //#region src/decorations.d.ts
505
+ interface DecorationOptions {
506
+ /**
507
+ * Custom decorations to wrap highlighted tokens with.
508
+ */
509
+ decorations?: DecorationItem[];
510
+ }
511
+ interface DecorationItem {
512
+ /**
513
+ * Start offset or position of the decoration.
514
+ */
515
+ start: OffsetOrPosition;
516
+ /**
517
+ * End offset or position of the decoration.
518
+ */
519
+ end: OffsetOrPosition;
520
+ /**
521
+ * Tag name of the element to create.
522
+ * @default 'span'
523
+ */
524
+ tagName?: string;
525
+ /**
526
+ * Properties of the element to create.
527
+ */
528
+ properties?: Element['properties'];
529
+ /**
530
+ * A custom function to transform the element after it has been created.
531
+ */
532
+ transform?: (element: Element, type: DecorationTransformType) => Element | void;
533
+ /**
534
+ * By default when the decoration contains only one token, the decoration will be applied to the token.
535
+ *
536
+ * Set to `true` to always wrap the token with a new element
537
+ *
538
+ * @default false
539
+ */
540
+ alwaysWrap?: boolean;
541
+ }
542
+ type DecorationTransformType = 'wrapper' | 'line' | 'token';
543
+ interface Position {
544
+ line: number;
545
+ character: number;
546
+ }
547
+ type Offset = number;
548
+ type OffsetOrPosition = Position | Offset;
549
+ //#endregion
550
+ //#region src/themes.d.ts
551
+ type SpecialTheme = 'none';
552
+ interface ThemeRegistrationRaw extends IRawTheme, Partial<Omit<ThemeRegistration, 'name' | 'settings'>> {}
553
+ interface ThemeRegistration extends Partial<ThemeRegistrationResolved> {}
554
+ interface ThemeRegistrationResolved extends IRawTheme {
555
+ /**
556
+ * Theme name
557
+ */
558
+ name: string;
559
+ /**
560
+ * Display name
561
+ *
562
+ * @field shiki custom property
563
+ */
564
+ displayName?: string;
565
+ /**
566
+ * Light/dark theme
567
+ *
568
+ * @field shiki custom property
569
+ */
570
+ type: 'light' | 'dark';
571
+ /**
572
+ * Token rules
573
+ */
574
+ settings: IRawThemeSetting[];
575
+ /**
576
+ * Same as `settings`, will use as fallback if `settings` is not present.
577
+ */
578
+ tokenColors?: IRawThemeSetting[];
579
+ /**
580
+ * Default foreground color
581
+ *
582
+ * @field shiki custom property
583
+ */
584
+ fg: string;
585
+ /**
586
+ * Background color
587
+ *
588
+ * @field shiki custom property
589
+ */
590
+ bg: string;
591
+ /**
592
+ * A map of color names to new color values.
593
+ *
594
+ * The color key starts with '#' and should be lowercased.
595
+ *
596
+ * @field shiki custom property
597
+ */
598
+ colorReplacements?: Record<string, string>;
599
+ /**
600
+ * Color map of VS Code options
601
+ *
602
+ * Will be used by shiki on `lang: 'ansi'` to find ANSI colors, and to find the default foreground/background colors.
603
+ */
604
+ colors?: Record<string, string>;
605
+ /**
606
+ * JSON schema path
607
+ *
608
+ * @field not used by shiki
609
+ */
610
+ $schema?: string;
611
+ /**
612
+ * Enable semantic highlighting
613
+ *
614
+ * @field not used by shiki
615
+ */
616
+ semanticHighlighting?: boolean;
617
+ /**
618
+ * Tokens for semantic highlighting
619
+ *
620
+ * @field not used by shiki
621
+ */
622
+ semanticTokenColors?: Record<string, string>;
623
+ }
624
+ type ThemeRegistrationAny = ThemeRegistrationRaw | ThemeRegistration | ThemeRegistrationResolved;
625
+ //#endregion
626
+ //#region src/tokens.d.ts
627
+ /**
628
+ * GrammarState is a special reference object that holds the state of a grammar.
629
+ *
630
+ * It's used to highlight code snippets that are part of the target language.
631
+ */
632
+ interface GrammarState {
633
+ readonly lang: string;
634
+ readonly theme: string;
635
+ readonly themes: string[];
636
+ /**
637
+ * @internal
638
+ */
639
+ getInternalStack: (theme?: string) => StateStack | undefined;
640
+ getScopes: (theme?: string) => string[] | undefined;
641
+ }
642
+ interface CodeToTokensBaseOptions<Languages extends string = string, Themes extends string = string> extends TokenizeWithThemeOptions {
643
+ lang?: Languages | SpecialLanguage;
644
+ theme?: Themes | ThemeRegistrationAny | SpecialTheme;
645
+ }
646
+ type CodeToTokensOptions<Languages extends string = string, Themes extends string = string> = Omit<CodeToTokensBaseOptions<Languages, Themes>, 'theme'> & CodeOptionsThemes<Themes>;
647
+ interface ThemedTokenScopeExplanation {
648
+ scopeName: string;
649
+ themeMatches?: IRawThemeSetting[];
650
+ }
651
+ interface ThemedTokenExplanation {
652
+ content: string;
653
+ scopes: ThemedTokenScopeExplanation[];
654
+ }
655
+ /**
656
+ * A single token with color, and optionally with explanation.
657
+ *
658
+ * For example:
659
+ *
660
+ * ```json
661
+ * {
662
+ * "content": "shiki",
663
+ * "color": "#D8DEE9",
664
+ * "explanation": [
665
+ * {
666
+ * "content": "shiki",
667
+ * "scopes": [
668
+ * {
669
+ * "scopeName": "source.js",
670
+ * "themeMatches": []
671
+ * },
672
+ * {
673
+ * "scopeName": "meta.objectliteral.js",
674
+ * "themeMatches": []
675
+ * },
676
+ * {
677
+ * "scopeName": "meta.object.member.js",
678
+ * "themeMatches": []
679
+ * },
680
+ * {
681
+ * "scopeName": "meta.array.literal.js",
682
+ * "themeMatches": []
683
+ * },
684
+ * {
685
+ * "scopeName": "variable.other.object.js",
686
+ * "themeMatches": [
687
+ * {
688
+ * "name": "Variable",
689
+ * "scope": "variable.other",
690
+ * "settings": {
691
+ * "foreground": "#D8DEE9"
692
+ * }
693
+ * },
694
+ * {
695
+ * "name": "[JavaScript] Variable Other Object",
696
+ * "scope": "source.js variable.other.object",
697
+ * "settings": {
698
+ * "foreground": "#D8DEE9"
699
+ * }
700
+ * }
701
+ * ]
702
+ * }
703
+ * ]
704
+ * }
705
+ * ]
706
+ * }
707
+ * ```
708
+ */
709
+ interface ThemedToken extends TokenStyles, TokenBase {}
710
+ interface TokenBase {
711
+ /**
712
+ * The content of the token
713
+ */
714
+ content: string;
715
+ /**
716
+ * The start offset of the token, relative to the input code. 0-indexed.
717
+ */
718
+ offset: number;
719
+ /**
720
+ * Explanation of
721
+ *
722
+ * - token text's matching scopes
723
+ * - reason that token text is given a color (one matching scope matches a rule (scope -> color) in the theme)
724
+ */
725
+ explanation?: ThemedTokenExplanation[];
726
+ }
727
+ interface TokenStyles {
728
+ /**
729
+ * 6 or 8 digit hex code representation of the token's color
730
+ */
731
+ color?: string;
732
+ /**
733
+ * 6 or 8 digit hex code representation of the token's background color
734
+ */
735
+ bgColor?: string;
736
+ /**
737
+ * Font style of token. Can be None/Italic/Bold/Underline
738
+ */
739
+ fontStyle?: FontStyle;
740
+ /**
741
+ * Override with custom inline style for HTML renderer.
742
+ * When specified, `color` and `fontStyle` will be ignored.
743
+ * Prefer use object style for merging with other styles.
744
+ */
745
+ htmlStyle?: Record<string, string>;
746
+ /**
747
+ * Extra HTML attributes for the token.
748
+ */
749
+ htmlAttrs?: Record<string, string>;
750
+ }
751
+ interface TokenizeWithThemeOptions {
752
+ /**
753
+ * Include explanation of why a token is given a color.
754
+ *
755
+ * You can optionally pass `scopeName` to only include explanation for scopes,
756
+ * which is more performant than full explanation.
757
+ *
758
+ * @default false
759
+ */
760
+ includeExplanation?: boolean | 'scopeName';
761
+ /**
762
+ * A map of color names to new color values.
763
+ *
764
+ * The color key starts with '#' and should be lowercased.
765
+ *
766
+ * This will be merged with theme's `colorReplacements` if any.
767
+ */
768
+ colorReplacements?: Record<string, string | Record<string, string>>;
769
+ /**
770
+ * Lines above this length will not be tokenized for performance reasons.
771
+ *
772
+ * @default 0 (no limit)
773
+ */
774
+ tokenizeMaxLineLength?: number;
775
+ /**
776
+ * Time limit in milliseconds for tokenizing a single line.
777
+ *
778
+ * @default 500 (0.5s)
779
+ */
780
+ tokenizeTimeLimit?: number;
781
+ /**
782
+ * Represent the state of the grammar, allowing to continue tokenizing from a intermediate grammar state.
783
+ *
784
+ * You can get the grammar state from `getLastGrammarState`.
785
+ */
786
+ grammarState?: GrammarState;
787
+ /**
788
+ * The code context of the grammar.
789
+ * Consider it a prepended code to the input code, that only participate the grammar inference but not presented in the final output.
790
+ *
791
+ * This will be ignored if `grammarState` is provided.
792
+ */
793
+ grammarContextCode?: string;
794
+ }
795
+ /**
796
+ * Result of `codeToTokens`, an object with 2D array of tokens and meta info like background and foreground color.
797
+ */
798
+ interface TokensResult {
799
+ /**
800
+ * 2D array of tokens, first dimension is lines, second dimension is tokens in a line.
801
+ */
802
+ tokens: ThemedToken[][];
803
+ /**
804
+ * Foreground color of the code.
805
+ */
806
+ fg?: string;
807
+ /**
808
+ * Background color of the code.
809
+ */
810
+ bg?: string;
811
+ /**
812
+ * A string representation of themes applied to the token.
813
+ */
814
+ themeName?: string;
815
+ /**
816
+ * Custom style string to be applied to the root `<pre>` element.
817
+ * When specified, `fg` and `bg` will be ignored.
818
+ */
819
+ rootStyle?: string | false;
820
+ /**
821
+ * The last grammar state of the code snippet.
822
+ */
823
+ grammarState?: GrammarState;
824
+ } //#endregion
825
+ //#region src/transformers.d.ts
826
+ interface TransformerOptions {
827
+ /**
828
+ * Transformers for the Shiki pipeline.
829
+ */
830
+ transformers?: ShikiTransformer[];
831
+ }
832
+ interface ShikiTransformerContextMeta {}
833
+ /**
834
+ * Common transformer context for all transformers hooks
835
+ */
836
+ interface ShikiTransformerContextCommon {
837
+ meta: ShikiTransformerContextMeta;
838
+ options: CodeToHastOptions;
839
+ codeToHast: (code: string, options: CodeToHastOptions) => Root;
840
+ codeToTokens: (code: string, options: CodeToTokensOptions) => TokensResult;
841
+ }
842
+ interface ShikiTransformerContextSource extends ShikiTransformerContextCommon {
843
+ readonly source: string;
844
+ }
845
+ /**
846
+ * Transformer context for HAST related hooks
847
+ */
848
+ interface ShikiTransformerContext extends ShikiTransformerContextSource {
849
+ readonly tokens: ThemedToken[][];
850
+ readonly root: Root;
851
+ readonly pre: Element;
852
+ readonly code: Element;
853
+ readonly lines: Element[];
854
+ readonly structure: CodeToHastOptions['structure'];
855
+ /**
856
+ * Utility to append class to a hast node
857
+ *
858
+ * If the `property.class` is a string, it will be splitted by space and converted to an array.
859
+ */
860
+ addClassToHast: (hast: Element, className: string | string[]) => Element;
861
+ }
862
+ interface ShikiTransformer {
863
+ /**
864
+ * Name of the transformer
865
+ */
866
+ name?: string;
867
+ /**
868
+ * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering
869
+ * is still subject to the `order` property in the hook object.
870
+ *
871
+ * Plugin invocation order:
872
+ * - `enforce: 'pre'` plugins
873
+ * - normal plugins
874
+ * - `enforce: 'post'` plugins
875
+ * - shiki post plugins
876
+ */
877
+ enforce?: 'pre' | 'post';
878
+ /**
879
+ * Transform the raw input code before passing to the highlighter.
880
+ */
881
+ preprocess?: (this: ShikiTransformerContextCommon, code: string, options: CodeToHastOptions) => string | void;
882
+ /**
883
+ * Transform the full tokens list before converting to HAST.
884
+ * Return a new tokens list will replace the original one.
885
+ */
886
+ tokens?: (this: ShikiTransformerContextSource, tokens: ThemedToken[][]) => ThemedToken[][] | void;
887
+ /**
888
+ * Transform the entire generated HAST tree. Return a new Node will replace the original one.
889
+ */
890
+ root?: (this: ShikiTransformerContext, hast: Root) => Root | void;
891
+ /**
892
+ * Transform the `<pre>` element. Return a new Node will replace the original one.
893
+ */
894
+ pre?: (this: ShikiTransformerContext, hast: Element) => Element | void;
895
+ /**
896
+ * Transform the `<code>` element. Return a new Node will replace the original one.
897
+ */
898
+ code?: (this: ShikiTransformerContext, hast: Element) => Element | void;
899
+ /**
900
+ * Transform each line `<span class="line">` element.
901
+ *
902
+ * @param hast
903
+ * @param line 1-based line number
904
+ */
905
+ line?: (this: ShikiTransformerContext, hast: Element, line: number) => Element | void;
906
+ /**
907
+ * Transform each token `<span>` element.
908
+ */
909
+ span?: (this: ShikiTransformerContext, hast: Element, line: number, col: number, lineElement: Element, token: ThemedToken) => Element | void;
910
+ /**
911
+ * Transform the generated HTML string before returning.
912
+ * This hook will only be called with `codeToHtml`.
913
+ */
914
+ postprocess?: (this: ShikiTransformerContextCommon, html: string, options: CodeToHastOptions) => string | void;
915
+ } //#endregion
916
+ //#region src/options.d.ts
917
+ interface CodeOptionsSingleTheme<Themes extends string = string> {
918
+ theme: ThemeRegistrationAny | StringLiteralUnion<Themes>;
919
+ }
920
+ interface CodeOptionsMultipleThemes<Themes extends string = string> {
921
+ /**
922
+ * A map of color names to themes.
923
+ * This allows you to specify multiple themes for the generated code.
924
+ *
925
+ * ```ts
926
+ * highlighter.codeToHtml(code, {
927
+ * lang: 'js',
928
+ * themes: {
929
+ * light: 'vitesse-light',
930
+ * dark: 'vitesse-dark',
931
+ * }
932
+ * })
933
+ * ```
934
+ *
935
+ * Will generate:
936
+ *
937
+ * ```html
938
+ * <span style="color:#111;--shiki-dark:#fff;">code</span>
939
+ * ```
940
+ *
941
+ * @see https://shiki.style/guide/dual-themes
942
+ */
943
+ themes: Partial<Record<string, ThemeRegistrationAny | StringLiteralUnion<Themes>>>;
944
+ /**
945
+ * The default theme applied to the code (via inline `color` style).
946
+ * The rest of the themes are applied via CSS variables, and toggled by CSS overrides.
947
+ *
948
+ * For example, if `defaultColor` is `light`, then `light` theme is applied to the code,
949
+ * and the `dark` theme and other custom themes are applied via CSS variables:
950
+ *
951
+ * ```html
952
+ * <span style="color:#{light};--shiki-dark:#{dark};--shiki-custom:#{custom};">code</span>
953
+ * ```
954
+ *
955
+ * When set to `false`, no default styles will be applied, and totally up to users to apply the styles:
956
+ *
957
+ * ```html
958
+ * <span style="--shiki-light:#{light};--shiki-dark:#{dark};--shiki-custom:#{custom};">code</span>
959
+ * ```
960
+ *
961
+ * When set to `light-dark()`, the default color will be rendered as `light-dark(#{light}, #{dark})`.
962
+ *
963
+ * ```html
964
+ * <span style="color:light-dark(#{light}, #{dark});--shiki-dark:#{dark};--shiki-custom:#{custom};">code</span>
965
+ * ```
966
+ *
967
+ * @default 'light'
968
+ */
969
+ defaultColor?: StringLiteralUnion<'light' | 'dark'> | 'light-dark()' | false;
970
+ /**
971
+ * The strategy to render multiple colors.
972
+ *
973
+ * - `css-vars`: Render the colors via CSS variables.
974
+ * - `none`: Do not render the colors, only use the default color.
975
+ *
976
+ * @default 'css-vars'
977
+ */
978
+ colorsRendering?: 'css-vars' | 'none';
979
+ /**
980
+ * Prefix of CSS variables used to store the color of the other theme.
981
+ *
982
+ * @default '--shiki-'
983
+ */
984
+ cssVariablePrefix?: string;
985
+ }
986
+ type CodeOptionsThemes<Themes extends string = string> = CodeOptionsSingleTheme<Themes> | CodeOptionsMultipleThemes<Themes>;
987
+ type CodeToHastOptions<Languages extends string = string, Themes extends string = string> = CodeToHastOptionsCommon<Languages> & CodeOptionsThemes<Themes> & CodeOptionsMeta;
988
+ interface CodeToHastOptionsCommon<Languages extends string = string> extends TransformerOptions, DecorationOptions, Pick<TokenizeWithThemeOptions, 'colorReplacements' | 'tokenizeMaxLineLength' | 'tokenizeTimeLimit' | 'grammarState' | 'grammarContextCode' | 'includeExplanation'> {
989
+ /**
990
+ * Data to be added to the root `<pre>` element.
991
+ */
992
+ data?: Record<string, unknown>;
993
+ /**
994
+ * The grammar name for the code.
995
+ */
996
+ lang: StringLiteralUnion<Languages | SpecialLanguage>;
997
+ /**
998
+ * Custom style string to be applied to the root `<pre>` element.
999
+ *
1000
+ * When set to `false`, no style will be applied.
1001
+ */
1002
+ rootStyle?: string | false;
1003
+ /**
1004
+ * Merge whitespace tokens to saving extra `<span>`.
1005
+ *
1006
+ * When set to true, it will merge whitespace tokens with the next token.
1007
+ * When set to false, it keep the output as-is.
1008
+ * When set to `never`, it will force to separate leading and trailing spaces from tokens.
1009
+ *
1010
+ * @default true
1011
+ */
1012
+ mergeWhitespaces?: boolean | 'never';
1013
+ /**
1014
+ * Merge consecutive tokens with the same style to reduce the number of DOM nodes.
1015
+ * This can improve rendering performance but may affect the structure of the output.
1016
+ *
1017
+ * @default false
1018
+ */
1019
+ mergeSameStyleTokens?: boolean;
1020
+ /**
1021
+ * The structure of the generated HAST and HTML.
1022
+ *
1023
+ * - `classic`: The classic structure with `<pre>` and `<code>` elements, each line wrapped with a `<span class="line">` element.
1024
+ * - `inline`: All tokens are rendered as `<span>`, line breaks are rendered as `<br>`. No `<pre>` or `<code>` elements. Default forground and background colors are not applied.
1025
+ *
1026
+ * @default 'classic'
1027
+ */
1028
+ structure?: 'classic' | 'inline';
1029
+ /**
1030
+ * Tab index of the root `<pre>` element.
1031
+ *
1032
+ * Set to `false` to disable tab index.
1033
+ *
1034
+ * @default 0
1035
+ */
1036
+ tabindex?: number | string | false;
1037
+ }
1038
+ interface CodeOptionsMeta {
1039
+ /**
1040
+ * Meta data passed to Shiki, usually used by plugin integrations to pass the code block header.
1041
+ *
1042
+ * Key values in meta will be serialized to the attributes of the root `<pre>` element.
1043
+ *
1044
+ * Keys starting with `_` will be ignored.
1045
+ *
1046
+ * A special key `__raw` key will be used to pass the raw code block header (if the integration supports it).
1047
+ */
1048
+ meta?: {
1049
+ /**
1050
+ * Raw string of the code block header.
1051
+ */
1052
+ __raw?: string;
1053
+ [key: string]: any;
1054
+ };
1055
+ }
1056
+ //#endregion
99
1057
  //#region src/_internal/code-transformers.d.ts
100
1058
  /**
101
1059
  * The canonical Shiki transformer chain for Nimbus. Returns a fresh
@@ -124,14 +1082,25 @@ interface IndexedEntry {
124
1082
  /** Description — undefined when the schema doesn't expose one or it's empty. */
125
1083
  description: string | undefined;
126
1084
  /**
127
- * Page URL path under the site (no origin, no trailing slash unless
128
- * empty). Computed via the convention that the **primary** docs
129
- * collection mounts at the site root (e.g. `/getting-started`) while
130
- * every other collection mounts under its name (`/api/payments/create`,
131
- * `/blog/my-first-post`). Routes building `.md` alternates append
132
- * `/index.md`; chrome building HTML links append a trailing slash.
1085
+ * Page URL path under the site (no origin). Browser-facing form:
1086
+ * trailing slash on HTML document routes (`/getting-started/`) so
1087
+ * `<a href>` consumers don't trigger a redirect on static hosts that
1088
+ * canonicalize directory-index pages. The primary docs collection
1089
+ * mounts at the site root, every other collection mounts under its
1090
+ * name (`/api/payments/create/`, `/blog/my-first-post/`). Routes
1091
+ * building `.md` alternates should consume `markdownUrl` rather than
1092
+ * deriving from this field — the root-index case (`/`) needs a
1093
+ * different shape than the trailing-slash-strip recipe produces.
133
1094
  */
134
1095
  url: string;
1096
+ /**
1097
+ * Site-relative URL of the page's clean-markdown alternate. Mirrors
1098
+ * the path the per-page `.md` route emits: `/getting-started/index.md`
1099
+ * for an entry at `/getting-started/`, `/index.md` for the root-index
1100
+ * entry. Consumers (`llms.txt`, the `.md` route's `Source:` line)
1101
+ * should use this directly instead of synthesizing from `url`.
1102
+ */
1103
+ markdownUrl: string;
135
1104
  }
136
1105
  interface IndexedTopLevelGroup {
137
1106
  /** Top-level slug — first URL segment under root. */
@@ -174,6 +1143,28 @@ interface IndexedTopLevel {
174
1143
  */
175
1144
  groups: IndexedTopLevelGroup[];
176
1145
  }
1146
+ /**
1147
+ * Cross-collection entry list for the agent-facing routes
1148
+ * (`llms.txt`, per-page `.md` alternates, future `llms-full.txt` and
1149
+ * `rag.jsonl`). Implements the indexing baseline of the two-layer
1150
+ * architecture documented at `/features/llms-txt`:
1151
+ *
1152
+ * - **Multi-collection by default, zero opt-in.** Iterates every
1153
+ * collection registered in `src/content.config.ts` except names
1154
+ * matching `partials` or starting with `_` (reserved).
1155
+ * - **Schema-tolerant.** Reads `title` and `description` if present;
1156
+ * falls back to the entry id for the title and omits the
1157
+ * description otherwise.
1158
+ * - **Per-page filters baked in.** Drops entries with `draft: true`;
1159
+ * absent fields read as the docs-schema default (`draft: false`).
1160
+ * All published pages are indexed — there is no per-page opt-out.
1161
+ * A page that genuinely shouldn't be agent-readable should be kept
1162
+ * out of the content collection entirely.
1163
+ *
1164
+ * The returned shape is identical regardless of which factory created
1165
+ * the collection: hand-rolled `defineCollection({ loader, schema })`
1166
+ * collections work without modification.
1167
+ */
177
1168
  declare function getIndexedEntries(): Promise<IndexedEntry[]>;
178
1169
  /**
179
1170
  * Partition the indexed entries into the shape the root `/llms.txt`
@@ -237,6 +1228,14 @@ declare function getSidebarSections(currentSlug: string, options?: {
237
1228
  *
238
1229
  * Walks the flattened sidebar; returns the surrounding entries. Honors
239
1230
  * `prev`/`next` frontmatter overrides if provided.
1231
+ *
1232
+ * When an override uses the object form with an internal `link`
1233
+ * (e.g. `prev: { link: "/getting-started" }`), the link is validated
1234
+ * against every visible content entry's URL at build time. A pointer
1235
+ * to a missing page fails the build with a clear error — the same
1236
+ * staleness-detection mechanism used for `previousSlug` in versioning.
1237
+ * The string form (`prev: "Custom label"`) is a label-only override
1238
+ * and doesn't go through link validation.
240
1239
  */
241
1240
  declare function getPrevNext(currentSlug: string, options?: {
242
1241
  overrides?: PrevNextOverrides;