vitepress 1.1.0 → 1.1.2
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/client/app/router.js +10 -4
- package/dist/node/cli.js +1 -1
- package/dist/node/index.d.ts +311 -317
- package/dist/node/index.js +2 -2
- package/dist/node/{serve-Csn-CKFx.js → serve-DZ7Ijn1Q.js} +213 -127
- package/package.json +56 -57
- package/types/default-theme.d.ts +2 -2
package/dist/node/index.d.ts
CHANGED
|
@@ -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$
|
|
7
|
+
import { Options as Options$3 } 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';
|
|
@@ -168,119 +168,6 @@ interface SitemapItem {
|
|
|
168
168
|
lastmodrealtime?: boolean;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
declare namespace Token {
|
|
172
|
-
type Nesting = 1 | 0 | -1;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Create new token and fill passed properties.
|
|
177
|
-
*/
|
|
178
|
-
declare class Token {
|
|
179
|
-
constructor(type: string, tag: string, nesting: Token.Nesting);
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Type of the token, e.g. "paragraph_open"
|
|
183
|
-
*/
|
|
184
|
-
type: string;
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* HTML tag name, e.g. "p"
|
|
188
|
-
*/
|
|
189
|
-
tag: string;
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* HTML attributes. Format: `[[name1, value1], [name2, value2]]`
|
|
193
|
-
*/
|
|
194
|
-
attrs: Array<[string, string]> | null;
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Source map info. Format: `[line_begin, line_end]`
|
|
198
|
-
*/
|
|
199
|
-
map: [number, number] | null;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Level change (number in {-1, 0, 1} set), where:
|
|
203
|
-
*
|
|
204
|
-
* - `1` means the tag is opening
|
|
205
|
-
* - `0` means the tag is self-closing
|
|
206
|
-
* - `-1` means the tag is closing
|
|
207
|
-
*/
|
|
208
|
-
nesting: 1 | 0 | -1;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* nesting level, the same as `state.level`
|
|
212
|
-
*/
|
|
213
|
-
level: number;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* An array of child nodes (inline and img tokens)
|
|
217
|
-
*/
|
|
218
|
-
children: Token[] | null;
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* In a case of self-closing tag (code, html, fence, etc.),
|
|
222
|
-
* it has contents of this tag.
|
|
223
|
-
*/
|
|
224
|
-
content: string;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* '*' or '_' for emphasis, fence string for fence, etc.
|
|
228
|
-
*/
|
|
229
|
-
markup: string;
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Fence info string
|
|
233
|
-
*/
|
|
234
|
-
info: string;
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* A place for plugins to store an arbitrary data
|
|
238
|
-
*/
|
|
239
|
-
meta: any;
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* True for block-level tokens, false for inline tokens.
|
|
243
|
-
* Used in renderer to calculate line breaks
|
|
244
|
-
*/
|
|
245
|
-
block: boolean;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* If it's true, ignore this element when rendering. Used for tight lists
|
|
249
|
-
* to hide paragraphs.
|
|
250
|
-
*/
|
|
251
|
-
hidden: boolean;
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Search attribute index by name.
|
|
255
|
-
*/
|
|
256
|
-
attrIndex(name: string): number;
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Add `[name, value]` attribute to list. Init attrs if necessary
|
|
260
|
-
*/
|
|
261
|
-
attrPush(attrData: [string, string]): void;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Set `name` attribute to `value`. Override old value if exists.
|
|
265
|
-
*/
|
|
266
|
-
attrSet(name: string, value: string): void;
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Get the value of attribute `name`, or null if it does not exist.
|
|
270
|
-
*/
|
|
271
|
-
attrGet(name: string): string | null;
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Join value to existing attribute via space. Or create new attribute if not
|
|
275
|
-
* exists. Useful to operate with token classes.
|
|
276
|
-
*/
|
|
277
|
-
attrJoin(name: string, value: string): void;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
declare namespace __token {
|
|
281
|
-
export { Token as default };
|
|
282
|
-
}
|
|
283
|
-
|
|
284
171
|
declare const LinkifyIt: {
|
|
285
172
|
(
|
|
286
173
|
schemas?: LinkifyIt.SchemaRules | LinkifyIt.Options,
|
|
@@ -378,92 +265,225 @@ declare namespace mdurl {
|
|
|
378
265
|
|
|
379
266
|
// import ucmicro from 'uc.micro';
|
|
380
267
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
268
|
+
declare const lib: {
|
|
269
|
+
mdurl: typeof mdurl;
|
|
270
|
+
// ucmicro: typeof ucmicro;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Merge objects
|
|
275
|
+
*/
|
|
276
|
+
declare function assign(target: any, ...sources: any[]): any;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Check if the type is string or not
|
|
280
|
+
*/
|
|
281
|
+
declare function isString(obj: any): obj is string;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* has own property
|
|
285
|
+
*/
|
|
286
|
+
declare function has(obj: any, key: keyof any): boolean;
|
|
287
|
+
|
|
288
|
+
declare function unescapeMd(str: string): string;
|
|
289
|
+
declare function unescapeAll(str: string): string;
|
|
290
|
+
|
|
291
|
+
declare function isValidEntityCode(code: number): boolean;
|
|
292
|
+
declare function fromCodePoint(code: number): string;
|
|
293
|
+
declare function escapeHtml(str: string): string;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Remove element from array and put another array at those position.
|
|
297
|
+
* Useful for some operations with tokens.
|
|
298
|
+
* Return a new array.
|
|
299
|
+
*/
|
|
300
|
+
declare function arrayReplaceAt<T>(src: T[], pos: number, newElements: T[]): T[];
|
|
301
|
+
|
|
302
|
+
declare function isSpace(code: number): boolean;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Zs (unicode class) || [\t\f\v\r\n]
|
|
306
|
+
*/
|
|
307
|
+
declare function isWhiteSpace(code: number): boolean;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Markdown ASCII punctuation characters.
|
|
311
|
+
*
|
|
312
|
+
* !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
|
|
313
|
+
* http://spec.commonmark.org/0.15/#ascii-punctuation-character
|
|
314
|
+
*
|
|
315
|
+
* Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.
|
|
316
|
+
*/
|
|
317
|
+
declare function isMdAsciiPunct(code: number): boolean;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Currently without astral characters support.
|
|
321
|
+
*/
|
|
322
|
+
declare function isPunctChar(ch: string): boolean;
|
|
323
|
+
|
|
324
|
+
declare function escapeRE(str: string): string;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Hepler to unify [reference labels].
|
|
328
|
+
*/
|
|
329
|
+
declare function normalizeReference(str: string): string;
|
|
330
|
+
|
|
331
|
+
declare const utils_arrayReplaceAt: typeof arrayReplaceAt;
|
|
332
|
+
declare const utils_assign: typeof assign;
|
|
333
|
+
declare const utils_escapeHtml: typeof escapeHtml;
|
|
334
|
+
declare const utils_escapeRE: typeof escapeRE;
|
|
335
|
+
declare const utils_fromCodePoint: typeof fromCodePoint;
|
|
336
|
+
declare const utils_has: typeof has;
|
|
337
|
+
declare const utils_isMdAsciiPunct: typeof isMdAsciiPunct;
|
|
338
|
+
declare const utils_isPunctChar: typeof isPunctChar;
|
|
339
|
+
declare const utils_isSpace: typeof isSpace;
|
|
340
|
+
declare const utils_isString: typeof isString;
|
|
341
|
+
declare const utils_isValidEntityCode: typeof isValidEntityCode;
|
|
342
|
+
declare const utils_isWhiteSpace: typeof isWhiteSpace;
|
|
343
|
+
declare const utils_lib: typeof lib;
|
|
344
|
+
declare const utils_normalizeReference: typeof normalizeReference;
|
|
345
|
+
declare const utils_unescapeAll: typeof unescapeAll;
|
|
346
|
+
declare const utils_unescapeMd: typeof unescapeMd;
|
|
347
|
+
declare namespace utils {
|
|
348
|
+
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
|
+
}
|
|
350
|
+
|
|
351
|
+
declare namespace parseLinkDestination {
|
|
352
|
+
interface ParseResult {
|
|
353
|
+
ok: boolean;
|
|
354
|
+
pos: number;
|
|
355
|
+
lines: number;
|
|
356
|
+
str: string;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
declare function parseLinkDestination(str: string, pos: number, max: number): parseLinkDestination.ParseResult;
|
|
361
|
+
|
|
362
|
+
type Nesting = 1 | 0 | -1;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Create new token and fill passed properties.
|
|
366
|
+
*/
|
|
367
|
+
declare class Token {
|
|
368
|
+
constructor(type: string, tag: string, nesting: Nesting);
|
|
385
369
|
|
|
386
370
|
/**
|
|
387
|
-
*
|
|
371
|
+
* Type of the token, e.g. "paragraph_open"
|
|
388
372
|
*/
|
|
389
|
-
|
|
373
|
+
type: string;
|
|
390
374
|
|
|
391
375
|
/**
|
|
392
|
-
*
|
|
376
|
+
* HTML tag name, e.g. "p"
|
|
393
377
|
*/
|
|
394
|
-
|
|
378
|
+
tag: string;
|
|
395
379
|
|
|
396
380
|
/**
|
|
397
|
-
*
|
|
381
|
+
* HTML attributes. Format: `[[name1, value1], [name2, value2]]`
|
|
398
382
|
*/
|
|
399
|
-
|
|
383
|
+
attrs: Array<[string, string]> | null;
|
|
400
384
|
|
|
401
|
-
|
|
402
|
-
|
|
385
|
+
/**
|
|
386
|
+
* Source map info. Format: `[line_begin, line_end]`
|
|
387
|
+
*/
|
|
388
|
+
map: [number, number] | null;
|
|
403
389
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
390
|
+
/**
|
|
391
|
+
* Level change (number in {-1, 0, 1} set), where:
|
|
392
|
+
*
|
|
393
|
+
* - `1` means the tag is opening
|
|
394
|
+
* - `0` means the tag is self-closing
|
|
395
|
+
* - `-1` means the tag is closing
|
|
396
|
+
*/
|
|
397
|
+
nesting: Nesting;
|
|
407
398
|
|
|
408
399
|
/**
|
|
409
|
-
*
|
|
410
|
-
* Useful for some operations with tokens.
|
|
411
|
-
* Return a new array.
|
|
400
|
+
* nesting level, the same as `state.level`
|
|
412
401
|
*/
|
|
413
|
-
|
|
402
|
+
level: number;
|
|
414
403
|
|
|
415
|
-
|
|
404
|
+
/**
|
|
405
|
+
* An array of child nodes (inline and img tokens)
|
|
406
|
+
*/
|
|
407
|
+
children: Token[] | null;
|
|
416
408
|
|
|
417
409
|
/**
|
|
418
|
-
*
|
|
410
|
+
* In a case of self-closing tag (code, html, fence, etc.),
|
|
411
|
+
* it has contents of this tag.
|
|
419
412
|
*/
|
|
420
|
-
|
|
413
|
+
content: string;
|
|
421
414
|
|
|
422
415
|
/**
|
|
423
|
-
*
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
*
|
|
416
|
+
* '*' or '_' for emphasis, fence string for fence, etc.
|
|
417
|
+
*/
|
|
418
|
+
markup: string;
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Fence info string
|
|
429
422
|
*/
|
|
430
|
-
|
|
423
|
+
info: string;
|
|
431
424
|
|
|
432
425
|
/**
|
|
433
|
-
*
|
|
426
|
+
* A place for plugins to store an arbitrary data
|
|
434
427
|
*/
|
|
435
|
-
|
|
428
|
+
meta: any;
|
|
436
429
|
|
|
437
|
-
|
|
430
|
+
/**
|
|
431
|
+
* True for block-level tokens, false for inline tokens.
|
|
432
|
+
* Used in renderer to calculate line breaks
|
|
433
|
+
*/
|
|
434
|
+
block: boolean;
|
|
438
435
|
|
|
439
436
|
/**
|
|
440
|
-
*
|
|
437
|
+
* If it's true, ignore this element when rendering. Used for tight lists
|
|
438
|
+
* to hide paragraphs.
|
|
441
439
|
*/
|
|
442
|
-
|
|
443
|
-
}
|
|
440
|
+
hidden: boolean;
|
|
444
441
|
|
|
445
|
-
|
|
442
|
+
/**
|
|
443
|
+
* Search attribute index by name.
|
|
444
|
+
*/
|
|
445
|
+
attrIndex(name: string): number;
|
|
446
446
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
length: number;
|
|
452
|
-
}
|
|
447
|
+
/**
|
|
448
|
+
* Add `[name, value]` attribute to list. Init attrs if necessary
|
|
449
|
+
*/
|
|
450
|
+
attrPush(attrData: [string, string]): void;
|
|
453
451
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
token: number;
|
|
459
|
-
end: number;
|
|
460
|
-
open: boolean;
|
|
461
|
-
close: boolean;
|
|
462
|
-
}
|
|
452
|
+
/**
|
|
453
|
+
* Set `name` attribute to `value`. Override old value if exists.
|
|
454
|
+
*/
|
|
455
|
+
attrSet(name: string, value: string): void;
|
|
463
456
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
457
|
+
/**
|
|
458
|
+
* Get the value of attribute `name`, or null if it does not exist.
|
|
459
|
+
*/
|
|
460
|
+
attrGet(name: string): string | null;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Join value to existing attribute via space. Or create new attribute if not
|
|
464
|
+
* exists. Useful to operate with token classes.
|
|
465
|
+
*/
|
|
466
|
+
attrJoin(name: string, value: string): void;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
interface Scanned {
|
|
470
|
+
can_open: boolean;
|
|
471
|
+
can_close: boolean;
|
|
472
|
+
length: number;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
interface Delimiter {
|
|
476
|
+
marker: number;
|
|
477
|
+
length: number;
|
|
478
|
+
jump: number;
|
|
479
|
+
token: number;
|
|
480
|
+
end: number;
|
|
481
|
+
open: boolean;
|
|
482
|
+
close: boolean;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
interface TokenMeta {
|
|
486
|
+
delimiters: Delimiter[];
|
|
467
487
|
}
|
|
468
488
|
|
|
469
489
|
declare class StateInline {
|
|
@@ -473,7 +493,7 @@ declare class StateInline {
|
|
|
473
493
|
env: any;
|
|
474
494
|
md: MarkdownIt;
|
|
475
495
|
tokens: Token[];
|
|
476
|
-
tokens_meta: Array<
|
|
496
|
+
tokens_meta: Array<TokenMeta | null>;
|
|
477
497
|
|
|
478
498
|
pos: number;
|
|
479
499
|
posMax: number;
|
|
@@ -490,7 +510,7 @@ declare class StateInline {
|
|
|
490
510
|
/**
|
|
491
511
|
* List of emphasis-like delimiters for current tag
|
|
492
512
|
*/
|
|
493
|
-
delimiters:
|
|
513
|
+
delimiters: Delimiter[];
|
|
494
514
|
|
|
495
515
|
// Stack of delimiter lists for upper level tags
|
|
496
516
|
// _prev_delimiters: StateInline.Delimiter[][];
|
|
@@ -504,7 +524,7 @@ declare class StateInline {
|
|
|
504
524
|
* Push new token to "stream".
|
|
505
525
|
* If pending text exists - flush it as text token
|
|
506
526
|
*/
|
|
507
|
-
push(type: string, tag: string, nesting:
|
|
527
|
+
push(type: string, tag: string, nesting: Nesting): Token;
|
|
508
528
|
|
|
509
529
|
/**
|
|
510
530
|
* Scan a sequence of emphasis-like markers, and determine whether
|
|
@@ -513,34 +533,22 @@ declare class StateInline {
|
|
|
513
533
|
* @param start position to scan from (it should point at a valid marker);
|
|
514
534
|
* @param canSplitWord determine if these markers can be found inside a word
|
|
515
535
|
*/
|
|
516
|
-
scanDelims(start: number, canSplitWord: boolean):
|
|
536
|
+
scanDelims(start: number, canSplitWord: boolean): Scanned;
|
|
517
537
|
|
|
518
538
|
Token: typeof Token;
|
|
519
539
|
}
|
|
520
540
|
|
|
521
541
|
declare function parseLinkLabel(state: StateInline, start: number, disableNested?: boolean): number;
|
|
522
542
|
|
|
523
|
-
declare namespace parseLinkDestination {
|
|
524
|
-
interface ParseResult {
|
|
525
|
-
ok: boolean;
|
|
526
|
-
pos: number;
|
|
527
|
-
lines: number;
|
|
528
|
-
str: string;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
declare function parseLinkDestination(str: string, pos: number, max: number): parseLinkDestination.ParseResult;
|
|
533
|
-
|
|
534
543
|
declare function parseLinkTitle(str: string, pos: number, max: number): parseLinkDestination.ParseResult;
|
|
535
544
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
545
|
+
declare const helpers_parseLinkDestination: typeof parseLinkDestination;
|
|
546
|
+
declare const helpers_parseLinkLabel: typeof parseLinkLabel;
|
|
547
|
+
declare const helpers_parseLinkTitle: typeof parseLinkTitle;
|
|
548
|
+
declare namespace helpers {
|
|
549
|
+
export { helpers_parseLinkDestination as parseLinkDestination, helpers_parseLinkLabel as parseLinkLabel, helpers_parseLinkTitle as parseLinkTitle };
|
|
540
550
|
}
|
|
541
551
|
|
|
542
|
-
declare const helpers: Helpers;
|
|
543
|
-
|
|
544
552
|
declare namespace Ruler {
|
|
545
553
|
interface RuleOptions {
|
|
546
554
|
/**
|
|
@@ -707,9 +715,7 @@ declare class Ruler<T> {
|
|
|
707
715
|
getRules(chainName: string): T[];
|
|
708
716
|
}
|
|
709
717
|
|
|
710
|
-
|
|
711
|
-
type ParentType = "blockquote" | "list" | "root" | "paragraph" | "reference";
|
|
712
|
-
}
|
|
718
|
+
type ParentType = "blockquote" | "list" | "root" | "paragraph" | "reference";
|
|
713
719
|
|
|
714
720
|
declare class StateBlock {
|
|
715
721
|
constructor(src: string, md: MarkdownIt, env: any, tokens: Token[]);
|
|
@@ -791,7 +797,7 @@ declare class StateBlock {
|
|
|
791
797
|
* can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
|
|
792
798
|
* used in lists to determine if they interrupt a paragraph
|
|
793
799
|
*/
|
|
794
|
-
parentType:
|
|
800
|
+
parentType: ParentType;
|
|
795
801
|
|
|
796
802
|
level: number;
|
|
797
803
|
|
|
@@ -803,7 +809,7 @@ declare class StateBlock {
|
|
|
803
809
|
/**
|
|
804
810
|
* Push new token to "stream".
|
|
805
811
|
*/
|
|
806
|
-
push(type: string, tag: string, nesting:
|
|
812
|
+
push(type: string, tag: string, nesting: Nesting): Token;
|
|
807
813
|
|
|
808
814
|
isEmpty(line: number): boolean;
|
|
809
815
|
|
|
@@ -837,15 +843,13 @@ declare class StateBlock {
|
|
|
837
843
|
Token: typeof Token;
|
|
838
844
|
}
|
|
839
845
|
|
|
840
|
-
|
|
841
|
-
type RuleBlock = (state: StateBlock, startLine: number, endLine: number, silent: boolean) => boolean;
|
|
842
|
-
}
|
|
846
|
+
type RuleBlock = (state: StateBlock, startLine: number, endLine: number, silent: boolean) => boolean;
|
|
843
847
|
|
|
844
848
|
declare class ParserBlock {
|
|
845
849
|
/**
|
|
846
850
|
* [[Ruler]] instance. Keep configuration of block rules.
|
|
847
851
|
*/
|
|
848
|
-
ruler: Ruler<
|
|
852
|
+
ruler: Ruler<RuleBlock>;
|
|
849
853
|
|
|
850
854
|
/**
|
|
851
855
|
* Generate tokens for input range
|
|
@@ -876,12 +880,10 @@ declare class StateCore {
|
|
|
876
880
|
Token: typeof Token;
|
|
877
881
|
}
|
|
878
882
|
|
|
879
|
-
|
|
880
|
-
type RuleCore = (state: StateCore) => void;
|
|
881
|
-
}
|
|
883
|
+
type RuleCore = (state: StateCore) => void;
|
|
882
884
|
|
|
883
885
|
declare class Core {
|
|
884
|
-
ruler: Ruler<
|
|
886
|
+
ruler: Ruler<RuleCore>;
|
|
885
887
|
|
|
886
888
|
/**
|
|
887
889
|
* Executes core chain rules.
|
|
@@ -891,22 +893,20 @@ declare class Core {
|
|
|
891
893
|
State: typeof StateCore;
|
|
892
894
|
}
|
|
893
895
|
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
type RuleInline2 = (state: StateInline) => boolean;
|
|
897
|
-
}
|
|
896
|
+
type RuleInline = (state: StateInline, silent: boolean) => boolean;
|
|
897
|
+
type RuleInline2 = (state: StateInline) => boolean;
|
|
898
898
|
|
|
899
899
|
declare class ParserInline {
|
|
900
900
|
/**
|
|
901
901
|
* [[Ruler]] instance. Keep configuration of inline rules.
|
|
902
902
|
*/
|
|
903
|
-
ruler: Ruler<
|
|
903
|
+
ruler: Ruler<RuleInline>;
|
|
904
904
|
|
|
905
905
|
/**
|
|
906
906
|
* [[Ruler]] instance. Second ruler used for post-processing
|
|
907
907
|
* (e.g. in emphasis-like rules).
|
|
908
908
|
*/
|
|
909
|
-
ruler2: Ruler<
|
|
909
|
+
ruler2: Ruler<RuleInline2>;
|
|
910
910
|
|
|
911
911
|
/**
|
|
912
912
|
* Skip single token by running all rules in validation mode;
|
|
@@ -927,21 +927,19 @@ declare class ParserInline {
|
|
|
927
927
|
State: typeof StateInline;
|
|
928
928
|
}
|
|
929
929
|
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
html_inline?: RenderRule | undefined;
|
|
944
|
-
}
|
|
930
|
+
type RenderRule = (tokens: Token[], idx: number, options: Options$2, env: any, self: Renderer) => string;
|
|
931
|
+
|
|
932
|
+
interface RenderRuleRecord {
|
|
933
|
+
[type: string]: RenderRule | undefined;
|
|
934
|
+
code_inline?: RenderRule | undefined;
|
|
935
|
+
code_block?: RenderRule | undefined;
|
|
936
|
+
fence?: RenderRule | undefined;
|
|
937
|
+
image?: RenderRule | undefined;
|
|
938
|
+
hardbreak?: RenderRule | undefined;
|
|
939
|
+
softbreak?: RenderRule | undefined;
|
|
940
|
+
text?: RenderRule | undefined;
|
|
941
|
+
html_block?: RenderRule | undefined;
|
|
942
|
+
html_inline?: RenderRule | undefined;
|
|
945
943
|
}
|
|
946
944
|
|
|
947
945
|
declare class Renderer {
|
|
@@ -971,7 +969,7 @@ declare class Renderer {
|
|
|
971
969
|
* See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)
|
|
972
970
|
* for more details and examples.
|
|
973
971
|
*/
|
|
974
|
-
rules:
|
|
972
|
+
rules: RenderRuleRecord;
|
|
975
973
|
|
|
976
974
|
/**
|
|
977
975
|
* Render token attributes to string.
|
|
@@ -986,7 +984,7 @@ declare class Renderer {
|
|
|
986
984
|
* @param idx token index to render
|
|
987
985
|
* @param options params of parser instance
|
|
988
986
|
*/
|
|
989
|
-
renderToken(tokens: Token[], idx: number, options:
|
|
987
|
+
renderToken(tokens: Token[], idx: number, options: Options$2): string;
|
|
990
988
|
|
|
991
989
|
/**
|
|
992
990
|
* The same as [[Renderer.render]], but for single token of `inline` type.
|
|
@@ -995,7 +993,7 @@ declare class Renderer {
|
|
|
995
993
|
* @param options params of parser instance
|
|
996
994
|
* @param env additional data from parsed input (references, for example)
|
|
997
995
|
*/
|
|
998
|
-
renderInline(tokens: Token[], options:
|
|
996
|
+
renderInline(tokens: Token[], options: Options$2, env: any): string;
|
|
999
997
|
|
|
1000
998
|
/**
|
|
1001
999
|
* Special kludge for image `alt` attributes to conform CommonMark spec.
|
|
@@ -1006,7 +1004,7 @@ declare class Renderer {
|
|
|
1006
1004
|
* @param options params of parser instance
|
|
1007
1005
|
* @param env additional data from parsed input (references, for example)
|
|
1008
1006
|
*/
|
|
1009
|
-
renderInlineAsText(tokens: Token[], options:
|
|
1007
|
+
renderInlineAsText(tokens: Token[], options: Options$2, env: any): string;
|
|
1010
1008
|
|
|
1011
1009
|
/**
|
|
1012
1010
|
* Takes token stream and generates HTML. Probably, you will never need to call
|
|
@@ -1016,101 +1014,97 @@ declare class Renderer {
|
|
|
1016
1014
|
* @param options params of parser instance
|
|
1017
1015
|
* @param env additional data from parsed input (references, for example)
|
|
1018
1016
|
*/
|
|
1019
|
-
render(tokens: Token[], options:
|
|
1017
|
+
render(tokens: Token[], options: Options$2, env: any): string;
|
|
1020
1018
|
}
|
|
1021
1019
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1020
|
+
/**
|
|
1021
|
+
* MarkdownIt provides named presets as a convenience to quickly
|
|
1022
|
+
* enable/disable active syntax rules and options for common use cases.
|
|
1023
|
+
*
|
|
1024
|
+
* - ["commonmark"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -
|
|
1025
|
+
* configures parser to strict [CommonMark](http://commonmark.org/) mode.
|
|
1026
|
+
* - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -
|
|
1027
|
+
* similar to GFM, used when no preset name given. Enables all available rules,
|
|
1028
|
+
* but still without html, typographer & autolinker.
|
|
1029
|
+
* - ["zero"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -
|
|
1030
|
+
* all rules disabled. Useful to quickly setup your config via `.enable()`.
|
|
1031
|
+
* For example, when you need only `bold` and `italic` markup and nothing else.
|
|
1032
|
+
*/
|
|
1033
|
+
type PresetName = "default" | "zero" | "commonmark";
|
|
1033
1034
|
|
|
1035
|
+
interface Options$2 {
|
|
1034
1036
|
/**
|
|
1035
|
-
*
|
|
1036
|
-
*
|
|
1037
|
-
*
|
|
1038
|
-
*
|
|
1039
|
-
* configures parser to strict [CommonMark](http://commonmark.org/) mode.
|
|
1040
|
-
* - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -
|
|
1041
|
-
* similar to GFM, used when no preset name given. Enables all available rules,
|
|
1042
|
-
* but still without html, typographer & autolinker.
|
|
1043
|
-
* - ["zero"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -
|
|
1044
|
-
* all rules disabled. Useful to quickly setup your config via `.enable()`.
|
|
1045
|
-
* For example, when you need only `bold` and `italic` markup and nothing else.
|
|
1037
|
+
* Set `true` to enable HTML tags in source. Be careful!
|
|
1038
|
+
* That's not safe! You may need external sanitizer to protect output from XSS.
|
|
1039
|
+
* It's better to extend features via plugins, instead of enabling HTML.
|
|
1040
|
+
* @default false
|
|
1046
1041
|
*/
|
|
1047
|
-
|
|
1042
|
+
html?: boolean | undefined;
|
|
1048
1043
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
html?: boolean | undefined;
|
|
1044
|
+
/**
|
|
1045
|
+
* Set `true` to add '/' when closing single tags
|
|
1046
|
+
* (`<br />`). This is needed only for full CommonMark compatibility. In real
|
|
1047
|
+
* world you will need HTML output.
|
|
1048
|
+
* @default false
|
|
1049
|
+
*/
|
|
1050
|
+
xhtmlOut?: boolean | undefined;
|
|
1057
1051
|
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
*/
|
|
1064
|
-
xhtmlOut?: boolean | undefined;
|
|
1052
|
+
/**
|
|
1053
|
+
* Set `true` to convert `\n` in paragraphs into `<br>`.
|
|
1054
|
+
* @default false
|
|
1055
|
+
*/
|
|
1056
|
+
breaks?: boolean | undefined;
|
|
1065
1057
|
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1058
|
+
/**
|
|
1059
|
+
* CSS language class prefix for fenced blocks.
|
|
1060
|
+
* Can be useful for external highlighters.
|
|
1061
|
+
* @default 'language-'
|
|
1062
|
+
*/
|
|
1063
|
+
langPrefix?: string | undefined;
|
|
1071
1064
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
langPrefix?: string | undefined;
|
|
1065
|
+
/**
|
|
1066
|
+
* Set `true` to autoconvert URL-like text to links.
|
|
1067
|
+
* @default false
|
|
1068
|
+
*/
|
|
1069
|
+
linkify?: boolean | undefined;
|
|
1078
1070
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1071
|
+
/**
|
|
1072
|
+
* Set `true` to enable [some language-neutral replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +
|
|
1073
|
+
* quotes beautification (smartquotes).
|
|
1074
|
+
* @default false
|
|
1075
|
+
*/
|
|
1076
|
+
typographer?: boolean | undefined;
|
|
1084
1077
|
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1078
|
+
/**
|
|
1079
|
+
* Double + single quotes replacement
|
|
1080
|
+
* pairs, when typographer enabled and smartquotes on. For example, you can
|
|
1081
|
+
* use `'«»„“'` for Russian, `'„“‚‘'` for German, and
|
|
1082
|
+
* `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp).
|
|
1083
|
+
* @default '“”‘’'
|
|
1084
|
+
*/
|
|
1085
|
+
quotes?: string | string[];
|
|
1091
1086
|
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1087
|
+
/**
|
|
1088
|
+
* Highlighter function for fenced code blocks.
|
|
1089
|
+
* Highlighter `function (str, lang, attrs)` should return escaped HTML. It can
|
|
1090
|
+
* also return empty string if the source was not changed and should be escaped
|
|
1091
|
+
* externally. If result starts with <pre... internal wrapper is skipped.
|
|
1092
|
+
* @default null
|
|
1093
|
+
*/
|
|
1094
|
+
highlight?: ((str: string, lang: string, attrs: string) => string) | null | undefined;
|
|
1095
|
+
}
|
|
1100
1096
|
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
* also return empty string if the source was not changed and should be escaped
|
|
1105
|
-
* externally. If result starts with <pre... internal wrapper is skipped.
|
|
1106
|
-
* @default null
|
|
1107
|
-
*/
|
|
1108
|
-
highlight?: ((str: string, lang: string, attrs: string) => string) | null | undefined;
|
|
1109
|
-
}
|
|
1097
|
+
type PluginSimple = (md: MarkdownIt) => void;
|
|
1098
|
+
type PluginWithOptions<T = any> = (md: MarkdownIt, options?: T) => void;
|
|
1099
|
+
type PluginWithParams = (md: MarkdownIt, ...params: any[]) => void;
|
|
1110
1100
|
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1101
|
+
interface MarkdownItConstructor {
|
|
1102
|
+
new(): MarkdownIt;
|
|
1103
|
+
new(presetName: PresetName, options?: Options$2): MarkdownIt;
|
|
1104
|
+
new(options: Options$2): MarkdownIt;
|
|
1105
|
+
(): MarkdownIt;
|
|
1106
|
+
(presetName: PresetName, options?: Options$2): MarkdownIt;
|
|
1107
|
+
(options: Options$2): MarkdownIt;
|
|
1114
1108
|
}
|
|
1115
1109
|
|
|
1116
1110
|
interface MarkdownIt {
|
|
@@ -1193,7 +1187,7 @@ interface MarkdownIt {
|
|
|
1193
1187
|
|
|
1194
1188
|
readonly helpers: typeof helpers;
|
|
1195
1189
|
|
|
1196
|
-
readonly options:
|
|
1190
|
+
readonly options: Options$2;
|
|
1197
1191
|
|
|
1198
1192
|
/**
|
|
1199
1193
|
* *chainable*
|
|
@@ -1214,7 +1208,7 @@ interface MarkdownIt {
|
|
|
1214
1208
|
* it's best to create multiple instances and initialize each with separate
|
|
1215
1209
|
* config.
|
|
1216
1210
|
*/
|
|
1217
|
-
set(options:
|
|
1211
|
+
set(options: Options$2): this;
|
|
1218
1212
|
|
|
1219
1213
|
/**
|
|
1220
1214
|
* *chainable*, *internal*
|
|
@@ -1226,7 +1220,7 @@ interface MarkdownIt {
|
|
|
1226
1220
|
* We strongly recommend to use presets instead of direct config loads. That
|
|
1227
1221
|
* will give better compatibility with next versions.
|
|
1228
1222
|
*/
|
|
1229
|
-
configure(presets:
|
|
1223
|
+
configure(presets: PresetName): this;
|
|
1230
1224
|
|
|
1231
1225
|
/**
|
|
1232
1226
|
* *chainable*
|
|
@@ -1274,9 +1268,9 @@ interface MarkdownIt {
|
|
|
1274
1268
|
* });
|
|
1275
1269
|
* ```
|
|
1276
1270
|
*/
|
|
1277
|
-
use(plugin:
|
|
1278
|
-
use<T = any>(plugin:
|
|
1279
|
-
use(plugin:
|
|
1271
|
+
use(plugin: PluginSimple): this;
|
|
1272
|
+
use<T = any>(plugin: PluginWithOptions<T>, options?: T): this;
|
|
1273
|
+
use(plugin: PluginWithParams, ...params: any[]): this;
|
|
1280
1274
|
|
|
1281
1275
|
/**
|
|
1282
1276
|
* *internal*
|
|
@@ -1785,7 +1779,7 @@ interface TocPluginOptions {
|
|
|
1785
1779
|
*
|
|
1786
1780
|
* @default 'ul'
|
|
1787
1781
|
*/
|
|
1788
|
-
listTag?: '
|
|
1782
|
+
listTag?: 'ol' | 'ul';
|
|
1789
1783
|
/**
|
|
1790
1784
|
* The class for the TOC list
|
|
1791
1785
|
*
|
|
@@ -1901,7 +1895,7 @@ type ThemeOptions = ThemeRegistrationAny | BuiltinTheme | {
|
|
|
1901
1895
|
light: ThemeRegistrationAny | BuiltinTheme;
|
|
1902
1896
|
dark: ThemeRegistrationAny | BuiltinTheme;
|
|
1903
1897
|
};
|
|
1904
|
-
interface MarkdownOptions extends
|
|
1898
|
+
interface MarkdownOptions extends Options$2 {
|
|
1905
1899
|
/**
|
|
1906
1900
|
* Setup markdown-it instance before applying plugins
|
|
1907
1901
|
*/
|
|
@@ -2091,7 +2085,7 @@ interface UserConfig<ThemeConfig = any> extends LocaleSpecificConfig<ThemeConfig
|
|
|
2091
2085
|
/**
|
|
2092
2086
|
* Options to pass on to `@vitejs/plugin-vue`
|
|
2093
2087
|
*/
|
|
2094
|
-
vue?: Options$
|
|
2088
|
+
vue?: Options$3;
|
|
2095
2089
|
/**
|
|
2096
2090
|
* Vite config
|
|
2097
2091
|
*/
|