vitepress 1.1.3 → 1.2.0

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.
@@ -4,7 +4,7 @@ import { BuildOptions, Logger, UserConfig as UserConfig$1, ConfigEnv, ServerOpti
4
4
  export { Plugin, loadEnv } from 'vite';
5
5
  import { Awaitable, SiteData, PageData, HeadConfig, LocaleSpecificConfig, LocaleConfig, SSGContext, DefaultTheme } from '../../types/shared.js';
6
6
  export { DefaultTheme, HeadConfig, Header, SiteData } from '../../types/shared.js';
7
- import { Options as Options$3 } from '@vitejs/plugin-vue';
7
+ import { Options as Options$4 } from '@vitejs/plugin-vue';
8
8
  import { UseDarkOptions } from '@vueuse/core';
9
9
  import { TransformOptions } from 'stream';
10
10
  import { ThemeRegistrationAny, BuiltinTheme, LanguageInput, ShikiTransformer, Highlighter } from 'shiki';
@@ -132,7 +132,7 @@ declare enum ErrorLevel {
132
132
  */
133
133
  THROW = "throw"
134
134
  }
135
- declare type ErrorHandler = (error: Error, level: ErrorLevel) => void;
135
+ declare type ErrorHandler$1 = (error: Error, level: ErrorLevel) => void;
136
136
 
137
137
  interface NSArgs {
138
138
  news: boolean;
@@ -147,7 +147,7 @@ interface SitemapStreamOptions extends TransformOptions {
147
147
  lastmodDateOnly?: boolean;
148
148
  xmlns?: NSArgs;
149
149
  xslUrl?: string;
150
- errorHandler?: ErrorHandler;
150
+ errorHandler?: ErrorHandler$1;
151
151
  }
152
152
 
153
153
  interface SitemapItem {
@@ -168,82 +168,202 @@ interface SitemapItem {
168
168
  lastmodrealtime?: boolean;
169
169
  }
170
170
 
171
- declare const LinkifyIt: {
172
- (
173
- schemas?: LinkifyIt.SchemaRules | LinkifyIt.Options,
174
- options?: LinkifyIt.Options,
175
- ): LinkifyIt.LinkifyIt;
176
- new(
177
- schemas?: LinkifyIt.SchemaRules | LinkifyIt.Options,
178
- options?: LinkifyIt.Options,
179
- ): LinkifyIt.LinkifyIt;
180
- };
181
-
182
- declare namespace LinkifyIt {
183
- type Validate = (text: string, pos: number, self: LinkifyIt) => number | boolean;
171
+ type Validate = (text: string, pos: number, self: LinkifyIt) => number | boolean;
184
172
 
185
- interface FullRule {
186
- validate: string | RegExp | Validate;
187
- normalize?: ((match: Match) => void) | undefined;
188
- }
173
+ interface FullRule {
174
+ validate: string | RegExp | Validate;
175
+ normalize?: ((match: Match) => void) | undefined;
176
+ }
189
177
 
190
- type Rule = string | FullRule;
178
+ type Rule = string | FullRule;
191
179
 
192
- interface SchemaRules {
193
- [schema: string]: Rule;
194
- }
180
+ /**
181
+ * An object, where each key/value describes protocol/rule:
182
+ *
183
+ * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`
184
+ * for example). `linkify-it` makes sure that prefix is not preceded with
185
+ * alphanumeric char and symbols. Only whitespaces and punctuation allowed.
186
+ * - __value__ - rule to check tail after link prefix
187
+ * - _String_ - just alias to existing rule
188
+ * - _Object_
189
+ * - _validate_ - validator function (should return matched length on success),
190
+ * or `RegExp`.
191
+ * - _normalize_ - optional function to normalize text & url of matched result
192
+ * (for example, for `@twitter` mentions).
193
+ */
194
+ interface SchemaRules {
195
+ [schema: string]: Rule;
196
+ }
195
197
 
196
- interface Options {
197
- fuzzyLink?: boolean | undefined;
198
- fuzzyIP?: boolean | undefined;
199
- fuzzyEmail?: boolean | undefined;
200
- }
198
+ interface Options$3 {
199
+ /**
200
+ * recognize URL-s without `http(s):` prefix. Default `true`.
201
+ */
202
+ fuzzyLink?: boolean | undefined;
203
+ /**
204
+ * allow IPs in fuzzy links above. Can conflict with some texts
205
+ * like version numbers. Default `false`.
206
+ */
207
+ fuzzyIP?: boolean | undefined;
208
+ /**
209
+ * recognize emails without `mailto:` prefix. Default `true`.
210
+ */
211
+ fuzzyEmail?: boolean | undefined;
212
+ }
201
213
 
202
- interface Match {
203
- index: number;
204
- lastIndex: number;
205
- raw: string;
206
- schema: string;
207
- text: string;
208
- url: string;
209
- }
214
+ /**
215
+ * Match result. Single element of array, returned by {@link LinkifyIt#match}.
216
+ */
217
+ declare class Match {
218
+ constructor(self: LinkifyIt, shift: number);
210
219
 
211
- interface LinkifyIt {
212
- // Use overloads to provide contextual typing to `FullRule.normalize`, which is ambiguous with string.normalize
213
- // This appears unneeded to the unified-signatures lint rule.
214
- add(schema: string, rule: string): LinkifyIt;
215
- // tslint:disable-next-line: unified-signatures
216
- add(schema: string, rule: FullRule | null): LinkifyIt;
217
- match(text: string): Match[] | null;
218
- normalize(raw: string): string;
219
- pretest(text: string): boolean;
220
- set(options: Options): LinkifyIt;
221
- test(text: string): boolean;
222
- testSchemaAt(text: string, schemaName: string, pos: number): number;
223
- tlds(list: string | string[], keepOld?: boolean): LinkifyIt;
224
- re: {
225
- [key: string]: RegExp;
226
- };
227
- }
220
+ /**
221
+ * First position of matched string.
222
+ */
223
+ index: number;
224
+ /**
225
+ * Next position after matched string.
226
+ */
227
+ lastIndex: number;
228
+ /**
229
+ * Matched string.
230
+ */
231
+ raw: string;
232
+ /**
233
+ * Prefix (protocol) for matched string.
234
+ */
235
+ schema: string;
236
+ /**
237
+ * Normalized text of matched string.
238
+ */
239
+ text: string;
240
+ /**
241
+ * Normalized url of matched string.
242
+ */
243
+ url: string;
228
244
  }
229
245
 
230
- declare namespace encode {
231
- const defaultChars: string;
232
- const componentChars: string;
233
- }
234
- declare function encode(str: string, exclude?: string, keepEscaped?: boolean): string;
235
246
 
236
- declare namespace decode {
237
- const defaultChars: string;
238
- const componentChars: string;
247
+ declare class LinkifyIt {
248
+ /**
249
+ * new LinkifyIt(schemas, options)
250
+ * - schemas (Object): Optional. Additional schemas to validate (prefix/validator)
251
+ * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }
252
+ *
253
+ * Creates new linkifier instance with optional additional schemas.
254
+ * Can be called without `new` keyword for convenience.
255
+ *
256
+ * By default understands:
257
+ *
258
+ * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links
259
+ * - "fuzzy" links and emails (example.com, foo@bar.com).
260
+ */
261
+ constructor(schemas?: SchemaRules | Options$3, options?: Options$3);
262
+
263
+ // Use overloads to provide contextual typing to `FullRule.normalize`, which is ambiguous with string.normalize
264
+ /**
265
+ * Add new rule definition. See constructor description for details.
266
+ *
267
+ * @param schema rule name (fixed pattern prefix)
268
+ * @param definition schema definition
269
+ */
270
+ add(schema: string, definition: string): this;
271
+ add(schema: string, definition: FullRule | null): this;
272
+
273
+ /**
274
+ * Set recognition options for links without schema.
275
+ */
276
+ set(options: Options$3): this;
277
+
278
+ /**
279
+ * Searches linkifiable pattern and returns `true` on success or `false` on fail.
280
+ */
281
+ test(text: string): boolean;
282
+
283
+ /**
284
+ * Very quick check, that can give false positives. Returns true if link MAY BE
285
+ * can exists. Can be used for speed optimization, when you need to check that
286
+ * link NOT exists.
287
+ */
288
+ pretest(text: string): boolean;
289
+
290
+ /**
291
+ * Similar to {@link LinkifyIt#test} but checks only specific protocol tail exactly
292
+ * at given position. Returns length of found pattern (0 on fail).
293
+ *
294
+ * @param text text to scan
295
+ * @param schema rule (schema) name
296
+ * @param pos text offset to check from
297
+ */
298
+ testSchemaAt(text: string, schema: string, pos: number): number;
299
+
300
+ /**
301
+ * Returns array of found link descriptions or `null` on fail. We strongly
302
+ * recommend to use {@link LinkifyIt#test} first, for best speed.
303
+ */
304
+ match(text: string): Match[] | null;
305
+
306
+ /**
307
+ * Returns fully-formed (not fuzzy) link if it starts at the beginning
308
+ * of the string, and null otherwise.
309
+ */
310
+ matchAtStart(text: string): Match | null;
311
+
312
+ /**
313
+ * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix)
314
+ * to avoid false positives. By default this algorythm used:
315
+ *
316
+ * - hostname with any 2-letter root zones are ok.
317
+ * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф
318
+ * are ok.
319
+ * - encoded (`xn--...`) root zones are ok.
320
+ *
321
+ * If list is replaced, then exact match for 2-chars root zones will be checked.
322
+ *
323
+ * @param list list of tlds
324
+ * @param keepOld merge with current list if `true` (`false` by default)
325
+ */
326
+ tlds(list: string | string[], keepOld?: boolean): this;
327
+
328
+ /**
329
+ * Default normalizer (if schema does not define it's own).
330
+ */
331
+ normalize(match: Match): void;
332
+
333
+ /**
334
+ * Override to modify basic RegExp-s.
335
+ */
336
+ onCompile(): void;
337
+
338
+ re: {
339
+ [key: string]: RegExp;
340
+ };
239
341
  }
240
- declare function decode(input: string, exclude?: string): string;
241
342
 
242
- declare function parse(input: string, slashesDenoteHost?: boolean): Url;
343
+ declare const decode: {
344
+ defaultChars: string;
345
+ componentChars: string;
346
+ /**
347
+ * Decode percent-encoded string.
348
+ */
349
+ (str: string, exclude?: string): string;
350
+ };
243
351
 
244
- declare function format(url: Url): string;
352
+ declare const encode: {
353
+ defaultChars: string;
354
+ componentChars: string;
355
+ /**
356
+ * Encode unsafe characters with percent-encoding, skipping already
357
+ * encoded sequences.
358
+ *
359
+ * @param str string to encode
360
+ * @param exclude list of characters to ignore (in addition to a-zA-Z0-9)
361
+ * @param keepEscaped don't encode '%' in a correct escape sequence (default: true)
362
+ */
363
+ (str: string, exclude?: string, keepEscaped?: boolean): string;
364
+ };
245
365
 
246
- interface Url {
366
+ declare class Url {
247
367
  protocol: string;
248
368
  slashes: string;
249
369
  auth: string;
@@ -252,50 +372,56 @@ interface Url {
252
372
  hash: string;
253
373
  search: string;
254
374
  pathname: string;
375
+
376
+ constructor();
377
+
378
+ parse(url: string, slashesDenoteHost?: boolean): this;
379
+ parseHost(host: string): void;
255
380
  }
256
381
 
382
+ declare function parse(url: string | Url, slashesDenoteHost?: boolean): Url;
383
+
384
+ declare function format(url: Omit<Url, "parse" | "parseHost">): string;
385
+
257
386
  type mdurl_Url = Url;
387
+ declare const mdurl_Url: typeof Url;
258
388
  declare const mdurl_decode: typeof decode;
259
389
  declare const mdurl_encode: typeof encode;
260
390
  declare const mdurl_format: typeof format;
261
391
  declare const mdurl_parse: typeof parse;
262
392
  declare namespace mdurl {
263
- export { type mdurl_Url as Url, mdurl_decode as decode, mdurl_encode as encode, mdurl_format as format, mdurl_parse as parse };
393
+ export { mdurl_Url as Url, mdurl_decode as decode, mdurl_encode as encode, mdurl_format as format, mdurl_parse as parse };
264
394
  }
265
395
 
266
- // import ucmicro from 'uc.micro';
396
+ // import * as ucmicro from "uc.micro";
267
397
 
268
398
  declare const lib: {
269
399
  mdurl: typeof mdurl;
270
- // ucmicro: typeof ucmicro;
400
+ ucmicro: any;
271
401
  };
272
402
 
273
403
  /**
274
404
  * Merge objects
275
405
  */
276
- declare function assign(target: any, ...sources: any[]): any;
406
+ declare function assign(obj: any, ...from: any[]): any;
277
407
 
278
- /**
279
- * Check if the type is string or not
280
- */
281
408
  declare function isString(obj: any): obj is string;
282
409
 
283
- /**
284
- * has own property
285
- */
286
410
  declare function has(obj: any, key: keyof any): boolean;
287
411
 
288
412
  declare function unescapeMd(str: string): string;
413
+
289
414
  declare function unescapeAll(str: string): string;
290
415
 
291
- declare function isValidEntityCode(code: number): boolean;
292
- declare function fromCodePoint(code: number): string;
416
+ declare function isValidEntityCode(c: number): boolean;
417
+
418
+ declare function fromCodePoint(c: number): string;
419
+
293
420
  declare function escapeHtml(str: string): string;
294
421
 
295
422
  /**
296
423
  * Remove element from array and put another array at those position.
297
- * Useful for some operations with tokens.
298
- * Return a new array.
424
+ * Useful for some operations with tokens
299
425
  */
300
426
  declare function arrayReplaceAt<T>(src: T[], pos: number, newElements: T[]): T[];
301
427
 
@@ -310,9 +436,10 @@ declare function isWhiteSpace(code: number): boolean;
310
436
  * Markdown ASCII punctuation characters.
311
437
  *
312
438
  * !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
313
- * http://spec.commonmark.org/0.15/#ascii-punctuation-character
314
439
  *
315
440
  * Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.
441
+ *
442
+ * @see http://spec.commonmark.org/0.15/#ascii-punctuation-character
316
443
  */
317
444
  declare function isMdAsciiPunct(code: number): boolean;
318
445
 
@@ -324,7 +451,7 @@ declare function isPunctChar(ch: string): boolean;
324
451
  declare function escapeRE(str: string): string;
325
452
 
326
453
  /**
327
- * Hepler to unify [reference labels].
454
+ * Helper to unify [reference labels].
328
455
  */
329
456
  declare function normalizeReference(str: string): string;
330
457
 
@@ -348,23 +475,20 @@ declare namespace utils {
348
475
  export { utils_arrayReplaceAt as arrayReplaceAt, utils_assign as assign, utils_escapeHtml as escapeHtml, utils_escapeRE as escapeRE, utils_fromCodePoint as fromCodePoint, utils_has as has, utils_isMdAsciiPunct as isMdAsciiPunct, utils_isPunctChar as isPunctChar, utils_isSpace as isSpace, utils_isString as isString, utils_isValidEntityCode as isValidEntityCode, utils_isWhiteSpace as isWhiteSpace, utils_lib as lib, utils_normalizeReference as normalizeReference, utils_unescapeAll as unescapeAll, utils_unescapeMd as unescapeMd };
349
476
  }
350
477
 
351
- declare namespace parseLinkDestination {
352
- interface ParseResult {
353
- ok: boolean;
354
- pos: number;
355
- lines: number;
356
- str: string;
357
- }
478
+ interface ParseLinkDestinationResult {
479
+ ok: boolean;
480
+ pos: number;
481
+ str: string;
358
482
  }
359
483
 
360
- declare function parseLinkDestination(str: string, pos: number, max: number): parseLinkDestination.ParseResult;
484
+ declare function parseLinkDestination(str: string, start: number, max: number): ParseLinkDestinationResult;
361
485
 
362
486
  type Nesting = 1 | 0 | -1;
363
487
 
364
- /**
365
- * Create new token and fill passed properties.
366
- */
367
488
  declare class Token {
489
+ /**
490
+ * Create new token and fill passed properties.
491
+ */
368
492
  constructor(type: string, tag: string, nesting: Nesting);
369
493
 
370
494
  /**
@@ -378,26 +502,26 @@ declare class Token {
378
502
  tag: string;
379
503
 
380
504
  /**
381
- * HTML attributes. Format: `[[name1, value1], [name2, value2]]`
505
+ * HTML attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
382
506
  */
383
507
  attrs: Array<[string, string]> | null;
384
508
 
385
509
  /**
386
- * Source map info. Format: `[line_begin, line_end]`
510
+ * Source map info. Format: `[ line_begin, line_end ]`
387
511
  */
388
512
  map: [number, number] | null;
389
513
 
390
514
  /**
391
515
  * Level change (number in {-1, 0, 1} set), where:
392
516
  *
393
- * - `1` means the tag is opening
394
- * - `0` means the tag is self-closing
517
+ * - `1` means the tag is opening
518
+ * - `0` means the tag is self-closing
395
519
  * - `-1` means the tag is closing
396
520
  */
397
521
  nesting: Nesting;
398
522
 
399
523
  /**
400
- * nesting level, the same as `state.level`
524
+ * Nesting level, the same as `state.level`
401
525
  */
402
526
  level: number;
403
527
 
@@ -418,7 +542,9 @@ declare class Token {
418
542
  markup: string;
419
543
 
420
544
  /**
421
- * Fence info string
545
+ * - Info string for "fence" tokens
546
+ * - The value "auto" for autolink "link_open" and "link_close" tokens
547
+ * - The string value of the item marker for ordered-list "list_item_open" tokens
422
548
  */
423
549
  info: string;
424
550
 
@@ -445,7 +571,7 @@ declare class Token {
445
571
  attrIndex(name: string): number;
446
572
 
447
573
  /**
448
- * Add `[name, value]` attribute to list. Init attrs if necessary
574
+ * Add `[ name, value ]` attribute to list. Init attrs if necessary
449
575
  */
450
576
  attrPush(attrData: [string, string]): void;
451
577
 
@@ -530,7 +656,7 @@ declare class StateInline {
530
656
  * Scan a sequence of emphasis-like markers, and determine whether
531
657
  * it can start an emphasis sequence or end an emphasis sequence.
532
658
  *
533
- * @param start position to scan from (it should point at a valid marker);
659
+ * @param start position to scan from (it should point at a valid marker)
534
660
  * @param canSplitWord determine if these markers can be found inside a word
535
661
  */
536
662
  scanDelims(start: number, canSplitWord: boolean): Scanned;
@@ -540,7 +666,35 @@ declare class StateInline {
540
666
 
541
667
  declare function parseLinkLabel(state: StateInline, start: number, disableNested?: boolean): number;
542
668
 
543
- declare function parseLinkTitle(str: string, pos: number, max: number): parseLinkDestination.ParseResult;
669
+ interface ParseLinkTitleResult {
670
+ /**
671
+ * if `true`, this is a valid link title
672
+ */
673
+ ok: boolean;
674
+ /**
675
+ * if `true`, this link can be continued on the next line
676
+ */
677
+ can_continue: boolean;
678
+ /**
679
+ * if `ok`, it's the position of the first character after the closing marker
680
+ */
681
+ pos: number;
682
+ /**
683
+ * if `ok`, it's the unescaped title
684
+ */
685
+ str: string;
686
+ /**
687
+ * expected closing marker character code
688
+ */
689
+ marker: number;
690
+ }
691
+
692
+ declare function parseLinkTitle(
693
+ str: string,
694
+ start: number,
695
+ max: number,
696
+ prev_state?: ParseLinkTitleResult,
697
+ ): ParseLinkTitleResult;
544
698
 
545
699
  declare const helpers_parseLinkDestination: typeof parseLinkDestination;
546
700
  declare const helpers_parseLinkLabel: typeof parseLinkLabel;
@@ -549,33 +703,31 @@ declare namespace helpers {
549
703
  export { helpers_parseLinkDestination as parseLinkDestination, helpers_parseLinkLabel as parseLinkLabel, helpers_parseLinkTitle as parseLinkTitle };
550
704
  }
551
705
 
552
- declare namespace Ruler {
553
- interface RuleOptions {
554
- /**
555
- * array with names of "alternate" chains.
556
- */
557
- alt: string[];
558
- }
706
+ interface RuleOptions {
707
+ /**
708
+ * array with names of "alternate" chains.
709
+ */
710
+ alt: string[];
559
711
  }
560
712
 
561
713
  /**
562
- * class Ruler
563
- *
564
- * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and
565
- * [[MarkdownIt#inline]] to manage sequences of functions (rules):
714
+ * Helper class, used by {@link MarkdownIt#core}, {@link MarkdownIt#block} and
715
+ * {@link MarkdownIt#inline} to manage sequences of functions (rules):
566
716
  *
567
717
  * - keep rules in defined order
568
718
  * - assign the name to each rule
569
719
  * - enable/disable rules
570
720
  * - add/replace rules
571
721
  * - allow assign rules to additional named chains (in the same)
572
- * - cacheing lists of active rules
722
+ * - caching lists of active rules
573
723
  *
574
724
  * You will not need use this class directly until write plugins. For simple
575
- * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and
576
- * [[MarkdownIt.use]].
725
+ * rules control use {@link MarkdownIt.disable}, {@link MarkdownIt.enable} and
726
+ * {@link MarkdownIt.use}.
577
727
  */
578
728
  declare class Ruler<T> {
729
+ constructor();
730
+
579
731
  /**
580
732
  * Replace rule by name with new function & options. Throws error if name not
581
733
  * found.
@@ -596,11 +748,10 @@ declare class Ruler<T> {
596
748
  * @param fn new rule function.
597
749
  * @param options new rule options (not mandatory).
598
750
  */
599
- at(name: string, fn: T, options?: Ruler.RuleOptions): void;
751
+ at(name: string, fn: T, options?: RuleOptions): void;
600
752
 
601
753
  /**
602
- * Add new rule to chain before one with given name. See also
603
- * [[Ruler.after]], [[Ruler.push]].
754
+ * Add new rule to chain before one with given name.
604
755
  *
605
756
  * ##### Example
606
757
  *
@@ -612,20 +763,17 @@ declare class Ruler<T> {
612
763
  * });
613
764
  * ```
614
765
  *
766
+ * @see {@link Ruler.after}, {@link Ruler.push}
767
+ *
615
768
  * @param beforeName new rule will be added before this one.
616
769
  * @param ruleName name of added rule.
617
770
  * @param fn rule function.
618
771
  * @param options rule options (not mandatory).
619
772
  */
620
- before(beforeName: string, ruleName: string, fn: T, options?: Ruler.RuleOptions): void;
773
+ before(beforeName: string, ruleName: string, fn: T, options?: RuleOptions): void;
621
774
 
622
775
  /**
623
- * Add new rule to chain after one with given name. See also
624
- * [[Ruler.before]], [[Ruler.push]].
625
- *
626
- * ##### Options:
627
- *
628
- * - __alt__ - array with names of "alternate" chains.
776
+ * Add new rule to chain after one with given name.
629
777
  *
630
778
  * ##### Example
631
779
  *
@@ -637,20 +785,17 @@ declare class Ruler<T> {
637
785
  * });
638
786
  * ```
639
787
  *
788
+ * @see {@link Ruler.before}, {@link Ruler.push}
789
+ *
640
790
  * @param afterName new rule will be added after this one.
641
791
  * @param ruleName name of added rule.
642
792
  * @param fn rule function.
643
793
  * @param options rule options (not mandatory).
644
794
  */
645
- after(afterName: string, ruleName: string, fn: T, options?: Ruler.RuleOptions): void;
795
+ after(afterName: string, ruleName: string, fn: T, options?: RuleOptions): void;
646
796
 
647
797
  /**
648
- * Push new rule to the end of chain. See also
649
- * [[Ruler.before]], [[Ruler.after]].
650
- *
651
- * ##### Options:
652
- *
653
- * - __alt__ - array with names of "alternate" chains.
798
+ * Push new rule to the end of chain.
654
799
  *
655
800
  * ##### Example
656
801
  *
@@ -662,11 +807,13 @@ declare class Ruler<T> {
662
807
  * });
663
808
  * ```
664
809
  *
810
+ * @see {@link Ruler.before}, {@link Ruler.after}
811
+ *
665
812
  * @param ruleName name of added rule.
666
813
  * @param fn rule function.
667
814
  * @param options rule options (not mandatory).
668
815
  */
669
- push(ruleName: string, fn: T, options?: Ruler.RuleOptions): void;
816
+ push(ruleName: string, fn: T, options?: RuleOptions): void;
670
817
 
671
818
  /**
672
819
  * Enable rules with given names. If any rule name not found - throw Error.
@@ -674,7 +821,7 @@ declare class Ruler<T> {
674
821
  *
675
822
  * Returns list of found rule names (if no exception happened).
676
823
  *
677
- * See also [[Ruler.disable]], [[Ruler.enableOnly]].
824
+ * @see {@link Ruler.disable}, {@link Ruler.enableOnly}
678
825
  *
679
826
  * @param list list of rule names to enable.
680
827
  * @param ignoreInvalid set `true` to ignore errors when rule not found.
@@ -685,12 +832,12 @@ declare class Ruler<T> {
685
832
  * Enable rules with given names, and disable everything else. If any rule name
686
833
  * not found - throw Error. Errors can be disabled by second param.
687
834
  *
688
- * See also [[Ruler.disable]], [[Ruler.enable]].
835
+ * @see {@link Ruler.disable}, {@link Ruler.enable}
689
836
  *
690
837
  * @param list list of rule names to enable (whitelist).
691
838
  * @param ignoreInvalid set `true` to ignore errors when rule not found.
692
839
  */
693
- enableOnly(list: string | string[], ignoreInvalid?: boolean): string[];
840
+ enableOnly(list: string | string[], ignoreInvalid?: boolean): void;
694
841
 
695
842
  /**
696
843
  * Disable rules with given names. If any rule name not found - throw Error.
@@ -698,7 +845,7 @@ declare class Ruler<T> {
698
845
  *
699
846
  * Returns list of found rule names (if no exception happened).
700
847
  *
701
- * See also [[Ruler.enable]], [[Ruler.enableOnly]].
848
+ * @see {@link Ruler.enable}, {@link Ruler.enableOnly}
702
849
  *
703
850
  * @param list list of rule names to disable.
704
851
  * @param ignoreInvalid set `true` to ignore errors when rule not found.
@@ -794,18 +941,12 @@ declare class StateBlock {
794
941
  listIndent: number;
795
942
 
796
943
  /**
797
- * can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
798
944
  * used in lists to determine if they interrupt a paragraph
799
945
  */
800
946
  parentType: ParentType;
801
947
 
802
948
  level: number;
803
949
 
804
- /**
805
- * renderer
806
- */
807
- result: string;
808
-
809
950
  /**
810
951
  * Push new token to "stream".
811
952
  */
@@ -847,7 +988,7 @@ type RuleBlock = (state: StateBlock, startLine: number, endLine: number, silent:
847
988
 
848
989
  declare class ParserBlock {
849
990
  /**
850
- * [[Ruler]] instance. Keep configuration of block rules.
991
+ * {@link Ruler} instance. Keep configuration of block rules.
851
992
  */
852
993
  ruler: Ruler<RuleBlock>;
853
994
 
@@ -883,6 +1024,9 @@ declare class StateCore {
883
1024
  type RuleCore = (state: StateCore) => void;
884
1025
 
885
1026
  declare class Core {
1027
+ /**
1028
+ * {@link Ruler} instance. Keep configuration of core rules.
1029
+ */
886
1030
  ruler: Ruler<RuleCore>;
887
1031
 
888
1032
  /**
@@ -898,12 +1042,12 @@ type RuleInline2 = (state: StateInline) => boolean;
898
1042
 
899
1043
  declare class ParserInline {
900
1044
  /**
901
- * [[Ruler]] instance. Keep configuration of inline rules.
1045
+ * {@link Ruler} instance. Keep configuration of inline rules.
902
1046
  */
903
1047
  ruler: Ruler<RuleInline>;
904
1048
 
905
1049
  /**
906
- * [[Ruler]] instance. Second ruler used for post-processing
1050
+ * {@link Ruler} instance. Second ruler used for post-processing
907
1051
  * (e.g. in emphasis-like rules).
908
1052
  */
909
1053
  ruler2: Ruler<RuleInline2>;
@@ -943,6 +1087,11 @@ interface RenderRuleRecord {
943
1087
  }
944
1088
 
945
1089
  declare class Renderer {
1090
+ /**
1091
+ * Creates new {@link Renderer} instance and fill {@link Renderer#rules} with defaults.
1092
+ */
1093
+ constructor();
1094
+
946
1095
  /**
947
1096
  * Contains render rules for tokens. Can be updated and extended.
948
1097
  *
@@ -966,8 +1115,7 @@ declare class Renderer {
966
1115
  * }
967
1116
  * ```
968
1117
  *
969
- * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)
970
- * for more details and examples.
1118
+ * @see https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.mjs
971
1119
  */
972
1120
  rules: RenderRuleRecord;
973
1121
 
@@ -978,7 +1126,7 @@ declare class Renderer {
978
1126
 
979
1127
  /**
980
1128
  * Default token renderer. Can be overriden by custom function
981
- * in [[Renderer#rules]].
1129
+ * in {@link Renderer#rules}.
982
1130
  *
983
1131
  * @param tokens list of tokens
984
1132
  * @param idx token index to render
@@ -987,9 +1135,9 @@ declare class Renderer {
987
1135
  renderToken(tokens: Token[], idx: number, options: Options$2): string;
988
1136
 
989
1137
  /**
990
- * The same as [[Renderer.render]], but for single token of `inline` type.
1138
+ * The same as {@link Renderer.render}, but for single token of `inline` type.
991
1139
  *
992
- * @param tokens list on block tokens to renter
1140
+ * @param tokens list of block tokens to render
993
1141
  * @param options params of parser instance
994
1142
  * @param env additional data from parsed input (references, for example)
995
1143
  */
@@ -1000,7 +1148,7 @@ declare class Renderer {
1000
1148
  * Don't try to use it! Spec requires to show `alt` content with stripped markup,
1001
1149
  * instead of simple escaping.
1002
1150
  *
1003
- * @param tokens list on block tokens to renter
1151
+ * @param tokens list of block tokens to render
1004
1152
  * @param options params of parser instance
1005
1153
  * @param env additional data from parsed input (references, for example)
1006
1154
  */
@@ -1010,7 +1158,7 @@ declare class Renderer {
1010
1158
  * Takes token stream and generates HTML. Probably, you will never need to call
1011
1159
  * this method directly.
1012
1160
  *
1013
- * @param tokens list on block tokens to renter
1161
+ * @param tokens list of block tokens to render
1014
1162
  * @param options params of parser instance
1015
1163
  * @param env additional data from parsed input (references, for example)
1016
1164
  */
@@ -1109,28 +1257,28 @@ interface MarkdownItConstructor {
1109
1257
 
1110
1258
  interface MarkdownIt {
1111
1259
  /**
1112
- * Instance of [[ParserInline]]. You may need it to add new rules when
1113
- * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
1114
- * [[MarkdownIt.enable]].
1260
+ * Instance of {@link ParserInline}. You may need it to add new rules when
1261
+ * writing plugins. For simple rules control use {@link MarkdownIt.disable} and
1262
+ * {@link MarkdownIt.enable}.
1115
1263
  */
1116
1264
  readonly inline: ParserInline;
1117
1265
 
1118
1266
  /**
1119
- * Instance of [[ParserBlock]]. You may need it to add new rules when
1120
- * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
1121
- * [[MarkdownIt.enable]].
1267
+ * Instance of {@link ParserBlock}. You may need it to add new rules when
1268
+ * writing plugins. For simple rules control use {@link MarkdownIt.disable} and
1269
+ * {@link MarkdownIt.enable}.
1122
1270
  */
1123
1271
  readonly block: ParserBlock;
1124
1272
 
1125
1273
  /**
1126
- * Instance of [[Core]] chain executor. You may need it to add new rules when
1127
- * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
1128
- * [[MarkdownIt.enable]].
1274
+ * Instance of {@link Core} chain executor. You may need it to add new rules when
1275
+ * writing plugins. For simple rules control use {@link MarkdownIt.disable} and
1276
+ * {@link MarkdownIt.enable}.
1129
1277
  */
1130
1278
  readonly core: Core;
1131
1279
 
1132
1280
  /**
1133
- * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering
1281
+ * Instance of {@link Renderer}. Use it to modify output look. Or to add rendering
1134
1282
  * rules for new token types, generated by plugins.
1135
1283
  *
1136
1284
  * ##### Example
@@ -1146,7 +1294,7 @@ interface MarkdownIt {
1146
1294
  * md.renderer.rules['my_token'] = myToken
1147
1295
  * ```
1148
1296
  *
1149
- * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).
1297
+ * See {@link Renderer} docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).
1150
1298
  */
1151
1299
  readonly renderer: Renderer;
1152
1300
 
@@ -1155,7 +1303,7 @@ interface MarkdownIt {
1155
1303
  * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)
1156
1304
  * rule.
1157
1305
  */
1158
- readonly linkify: LinkifyIt.LinkifyIt;
1306
+ readonly linkify: LinkifyIt;
1159
1307
 
1160
1308
  /**
1161
1309
  * Link validation function. CommonMark allows too much in links. By default
@@ -1245,7 +1393,7 @@ interface MarkdownIt {
1245
1393
  /**
1246
1394
  * *chainable*
1247
1395
  *
1248
- * The same as [[MarkdownIt.enable]], but turn specified rules off.
1396
+ * The same as {@link MarkdownIt.enable}, but turn specified rules off.
1249
1397
  *
1250
1398
  * @param list rule name or list of rule names to disable.
1251
1399
  * @param ignoreInvalid set `true` to ignore errors when rule not found.
@@ -1295,7 +1443,7 @@ interface MarkdownIt {
1295
1443
  *
1296
1444
  * `env` can be used to inject additional metadata (`{}` by default).
1297
1445
  * But you will not need it with high probability. See also comment
1298
- * in [[MarkdownIt.parse]].
1446
+ * in {@link MarkdownIt.parse}.
1299
1447
  *
1300
1448
  * @param src source string
1301
1449
  * @param env environment sandbox
@@ -1305,7 +1453,7 @@ interface MarkdownIt {
1305
1453
  /**
1306
1454
  * *internal*
1307
1455
  *
1308
- * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the
1456
+ * The same as {@link MarkdownIt.parse} but skip all block rules. It returns the
1309
1457
  * block tokens list with the single `inline` element, containing parsed inline
1310
1458
  * tokens in `children` property. Also updates `env` object.
1311
1459
  *
@@ -1315,7 +1463,7 @@ interface MarkdownIt {
1315
1463
  parseInline(src: string, env: any): Token[];
1316
1464
 
1317
1465
  /**
1318
- * Similar to [[MarkdownIt.render]] but for single paragraph content. Result
1466
+ * Similar to {@link MarkdownIt.render} but for single paragraph content. Result
1319
1467
  * will NOT be wrapped into `<p>` tags.
1320
1468
  *
1321
1469
  * @param src source string
@@ -1953,6 +2101,11 @@ interface MarkdownOptions extends Options$2 {
1953
2101
  * Setup Shiki instance
1954
2102
  */
1955
2103
  shikiSetup?: (shiki: Highlighter) => void | Promise<void>;
2104
+ /**
2105
+ * The tooltip text for the copy button in code blocks
2106
+ * @default 'Copy Code'
2107
+ */
2108
+ codeCopyButtonTitle?: string;
1956
2109
  /**
1957
2110
  * Options for `markdown-it-anchor`
1958
2111
  * @see https://github.com/valeriangalliat/markdown-it-anchor
@@ -2085,7 +2238,7 @@ interface UserConfig<ThemeConfig = any> extends LocaleSpecificConfig<ThemeConfig
2085
2238
  /**
2086
2239
  * Options to pass on to `@vitejs/plugin-vue`
2087
2240
  */
2088
- vue?: Options$3;
2241
+ vue?: Options$4;
2089
2242
  /**
2090
2243
  * Vite config
2091
2244
  */
@@ -2378,73 +2531,61 @@ declare class Trouter<T = Function> {
2378
2531
  type Promisable<T> = Promise<T> | T;
2379
2532
  type ListenCallback = () => Promisable<void>;
2380
2533
 
2381
- declare namespace polka {
2382
- export interface IError extends Error {
2383
- code?: number;
2384
- status?: number;
2385
- details?: any;
2386
- }
2387
-
2388
- export type NextHandler = (err?: string | IError) => Promisable<void>;
2389
- export type ErrorHandler<T extends Request = Request> = (err: string | IError, req: T, res: Response, next: NextHandler) => Promisable<void>;
2390
- export type Middleware<T extends IncomingMessage = Request> = (req: T & Request, res: Response, next: NextHandler) => Promisable<void>;
2391
-
2392
- export interface IOptions<T extends Request = Request> {
2393
- server?: Server;
2394
- onNoMatch?: Middleware<T>;
2395
- onError?: ErrorHandler<T>;
2396
- }
2397
-
2398
- export type Response = ServerResponse;
2399
-
2400
- export interface Request extends IncomingMessage {
2401
- url: string;
2402
- method: string;
2403
- originalUrl: string;
2404
- params: Record<string, string>;
2405
- path: string;
2406
- search: string;
2407
- query: Record<string,string>;
2408
- body?: any;
2409
- _decoded?: true;
2410
- _parsedUrl: ParsedURL;
2411
- }
2412
-
2413
- export interface Polka<T extends Request = Request> extends Trouter<Middleware<T>> {
2414
- readonly server: Server;
2415
- readonly wares: Middleware<T>[];
2416
-
2417
- readonly onError: ErrorHandler<T>;
2418
- readonly onNoMatch: Middleware<T>;
2419
-
2420
- readonly handler: Middleware<T>;
2421
- parse: (req: IncomingMessage) => ParsedURL;
2422
-
2423
- use(pattern: RegExp|string, ...handlers: (Polka<T> | Middleware<T>)[]): this;
2424
- use(...handlers: (Polka<T> | Middleware<T>)[]): this;
2425
-
2426
- listen(port?: number, hostname?: string, backlog?: number, callback?: ListenCallback): this;
2427
- listen(port?: number, hostname?: string, callback?: ListenCallback): this;
2428
- listen(port?: number, backlog?: number, callback?: ListenCallback): this;
2429
- listen(port?: number, callback?: ListenCallback): this;
2430
- listen(path: string, backlog?: number, callback?: ListenCallback): this;
2431
- listen(path: string, callback?: ListenCallback): this;
2432
- listen(options: ListenOptions, callback?: ListenCallback): this;
2433
- listen(handle: any, backlog?: number, callback?: ListenCallback): this;
2434
- listen(handle: any, callback?: ListenCallback): this;
2435
- }
2436
- }
2437
-
2438
- declare function polka<T extends polka.Request = polka.Request>(
2439
- options?: polka.IOptions<T>
2440
- ): polka.Polka<T>;
2534
+ interface IError extends Error {
2535
+ code?: number;
2536
+ status?: number;
2537
+ details?: any;
2538
+ }
2539
+
2540
+ type NextHandler = (err?: string | IError) => Promisable<void>;
2541
+ type ErrorHandler<T extends Request = Request> = (err: string | IError, req: T, res: Response, next: NextHandler) => Promisable<void>;
2542
+ type Middleware<T extends IncomingMessage = Request> = (req: T & Request, res: Response, next: NextHandler) => Promisable<void>;
2543
+
2544
+ type Response = ServerResponse;
2545
+
2546
+ interface Request extends IncomingMessage {
2547
+ url: string;
2548
+ method: string;
2549
+ originalUrl: string;
2550
+ params: Record<string, string>;
2551
+ path: string;
2552
+ search: string;
2553
+ query: Record<string,string>;
2554
+ body?: any;
2555
+ _decoded?: true;
2556
+ _parsedUrl: ParsedURL;
2557
+ }
2558
+
2559
+ interface Polka<T extends Request = Request> extends Trouter<Middleware<T>> {
2560
+ readonly server: Server;
2561
+ readonly wares: Middleware<T>[];
2562
+
2563
+ readonly onError: ErrorHandler<T>;
2564
+ readonly onNoMatch: Middleware<T>;
2565
+
2566
+ readonly handler: Middleware<T>;
2567
+ parse: (req: IncomingMessage) => ParsedURL;
2568
+
2569
+ use(pattern: RegExp|string, ...handlers: (Polka<T> | Middleware<T>)[]): this;
2570
+ use(...handlers: (Polka<T> | Middleware<T>)[]): this;
2571
+
2572
+ listen(port?: number, hostname?: string, backlog?: number, callback?: ListenCallback): this;
2573
+ listen(port?: number, hostname?: string, callback?: ListenCallback): this;
2574
+ listen(port?: number, backlog?: number, callback?: ListenCallback): this;
2575
+ listen(port?: number, callback?: ListenCallback): this;
2576
+ listen(path: string, backlog?: number, callback?: ListenCallback): this;
2577
+ listen(path: string, callback?: ListenCallback): this;
2578
+ listen(options: ListenOptions, callback?: ListenCallback): this;
2579
+ listen(handle: any, backlog?: number, callback?: ListenCallback): this;
2580
+ listen(handle: any, callback?: ListenCallback): this;
2581
+ }
2441
2582
 
2442
2583
  interface ServeOptions {
2443
2584
  base?: string;
2444
2585
  root?: string;
2445
2586
  port?: number;
2446
2587
  }
2447
- declare function serve(options?: ServeOptions): Promise<polka.Polka<polka.Request>>;
2588
+ declare function serve(options?: ServeOptions): Promise<Polka<Request>>;
2448
2589
 
2449
2590
  declare function createServer(root?: string, serverOptions?: ServerOptions & {
2450
2591
  base?: string;