marked 12.0.0 → 12.0.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/lib/marked.cjs +12 -5
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.d.cts +21 -2
- package/lib/marked.d.ts +21 -2
- package/lib/marked.esm.js +12 -5
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +12 -5
- package/lib/marked.umd.js.map +1 -1
- package/man/marked.1 +1 -1
- package/marked.min.js +2 -2
- package/package.json +18 -18
package/lib/marked.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.
|
|
1
|
+
// Generated by dts-bundle-generator v9.3.1
|
|
2
2
|
|
|
3
3
|
export type Token = (Tokens.Space | Tokens.Code | Tokens.Heading | Tokens.Table | Tokens.Hr | Tokens.Blockquote | Tokens.List | Tokens.ListItem | Tokens.Paragraph | Tokens.HTML | Tokens.Text | Tokens.Def | Tokens.Escape | Tokens.Tag | Tokens.Image | Tokens.Link | Tokens.Strong | Tokens.Em | Tokens.Codespan | Tokens.Br | Tokens.Del | Tokens.Generic);
|
|
4
4
|
export declare namespace Tokens {
|
|
@@ -152,6 +152,9 @@ export type Links = Record<string, Pick<Tokens.Link | Tokens.Image, "href" | "ti
|
|
|
152
152
|
export type TokensList = Token[] & {
|
|
153
153
|
links: Links;
|
|
154
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* Renderer
|
|
157
|
+
*/
|
|
155
158
|
declare class _Renderer {
|
|
156
159
|
options: MarkedOptions;
|
|
157
160
|
constructor(options?: MarkedOptions);
|
|
@@ -182,6 +185,10 @@ declare class _Renderer {
|
|
|
182
185
|
image(href: string, title: string | null, text: string): string;
|
|
183
186
|
text(text: string): string;
|
|
184
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* TextRenderer
|
|
190
|
+
* returns only the textual part of the token
|
|
191
|
+
*/
|
|
185
192
|
declare class _TextRenderer {
|
|
186
193
|
strong(text: string): string;
|
|
187
194
|
em(text: string): string;
|
|
@@ -193,6 +200,9 @@ declare class _TextRenderer {
|
|
|
193
200
|
image(href: string, title: string | null, text: string): string;
|
|
194
201
|
br(): string;
|
|
195
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Parsing & Compiling
|
|
205
|
+
*/
|
|
196
206
|
declare class _Parser {
|
|
197
207
|
options: MarkedOptions;
|
|
198
208
|
renderer: _Renderer;
|
|
@@ -305,6 +315,9 @@ export interface Rules {
|
|
|
305
315
|
block: Record<BlockKeys, RegExp>;
|
|
306
316
|
inline: Record<InlineKeys, RegExp>;
|
|
307
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Tokenizer
|
|
320
|
+
*/
|
|
308
321
|
declare class _Tokenizer {
|
|
309
322
|
options: MarkedOptions;
|
|
310
323
|
rules: Rules;
|
|
@@ -470,6 +483,9 @@ export interface MarkedOptions extends Omit<MarkedExtension, "hooks" | "renderer
|
|
|
470
483
|
*/
|
|
471
484
|
walkTokens?: null | ((token: Token) => void | Promise<void> | (void | Promise<void>)[]);
|
|
472
485
|
}
|
|
486
|
+
/**
|
|
487
|
+
* Block Lexer
|
|
488
|
+
*/
|
|
473
489
|
declare class _Lexer {
|
|
474
490
|
tokens: TokensList;
|
|
475
491
|
options: MarkedOptions;
|
|
@@ -554,6 +570,9 @@ declare class _Lexer {
|
|
|
554
570
|
*/
|
|
555
571
|
inlineTokens(src: string, tokens?: Token[]): Token[];
|
|
556
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* Gets the original marked default options.
|
|
575
|
+
*/
|
|
557
576
|
declare function _getDefaults(): MarkedOptions;
|
|
558
577
|
declare let _defaults: MarkedOptions;
|
|
559
578
|
export type MaybePromise = void | Promise<void>;
|
|
@@ -594,7 +613,7 @@ export declare function marked(src: string, options: MarkedOptions & {
|
|
|
594
613
|
*
|
|
595
614
|
* @param src String of markdown source to be compiled
|
|
596
615
|
* @param options Optional hash of options
|
|
597
|
-
* @return String of compiled HTML.
|
|
616
|
+
* @return String of compiled HTML. Will be a Promise of string if async is set to true by any extensions.
|
|
598
617
|
*/
|
|
599
618
|
export declare function marked(src: string, options?: MarkedOptions): string | Promise<string>;
|
|
600
619
|
export declare namespace marked {
|
package/lib/marked.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator v9.
|
|
1
|
+
// Generated by dts-bundle-generator v9.3.1
|
|
2
2
|
|
|
3
3
|
export type Token = (Tokens.Space | Tokens.Code | Tokens.Heading | Tokens.Table | Tokens.Hr | Tokens.Blockquote | Tokens.List | Tokens.ListItem | Tokens.Paragraph | Tokens.HTML | Tokens.Text | Tokens.Def | Tokens.Escape | Tokens.Tag | Tokens.Image | Tokens.Link | Tokens.Strong | Tokens.Em | Tokens.Codespan | Tokens.Br | Tokens.Del | Tokens.Generic);
|
|
4
4
|
export declare namespace Tokens {
|
|
@@ -152,6 +152,9 @@ export type Links = Record<string, Pick<Tokens.Link | Tokens.Image, "href" | "ti
|
|
|
152
152
|
export type TokensList = Token[] & {
|
|
153
153
|
links: Links;
|
|
154
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* Renderer
|
|
157
|
+
*/
|
|
155
158
|
declare class _Renderer {
|
|
156
159
|
options: MarkedOptions;
|
|
157
160
|
constructor(options?: MarkedOptions);
|
|
@@ -182,6 +185,10 @@ declare class _Renderer {
|
|
|
182
185
|
image(href: string, title: string | null, text: string): string;
|
|
183
186
|
text(text: string): string;
|
|
184
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* TextRenderer
|
|
190
|
+
* returns only the textual part of the token
|
|
191
|
+
*/
|
|
185
192
|
declare class _TextRenderer {
|
|
186
193
|
strong(text: string): string;
|
|
187
194
|
em(text: string): string;
|
|
@@ -193,6 +200,9 @@ declare class _TextRenderer {
|
|
|
193
200
|
image(href: string, title: string | null, text: string): string;
|
|
194
201
|
br(): string;
|
|
195
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Parsing & Compiling
|
|
205
|
+
*/
|
|
196
206
|
declare class _Parser {
|
|
197
207
|
options: MarkedOptions;
|
|
198
208
|
renderer: _Renderer;
|
|
@@ -305,6 +315,9 @@ export interface Rules {
|
|
|
305
315
|
block: Record<BlockKeys, RegExp>;
|
|
306
316
|
inline: Record<InlineKeys, RegExp>;
|
|
307
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Tokenizer
|
|
320
|
+
*/
|
|
308
321
|
declare class _Tokenizer {
|
|
309
322
|
options: MarkedOptions;
|
|
310
323
|
rules: Rules;
|
|
@@ -470,6 +483,9 @@ export interface MarkedOptions extends Omit<MarkedExtension, "hooks" | "renderer
|
|
|
470
483
|
*/
|
|
471
484
|
walkTokens?: null | ((token: Token) => void | Promise<void> | (void | Promise<void>)[]);
|
|
472
485
|
}
|
|
486
|
+
/**
|
|
487
|
+
* Block Lexer
|
|
488
|
+
*/
|
|
473
489
|
declare class _Lexer {
|
|
474
490
|
tokens: TokensList;
|
|
475
491
|
options: MarkedOptions;
|
|
@@ -554,6 +570,9 @@ declare class _Lexer {
|
|
|
554
570
|
*/
|
|
555
571
|
inlineTokens(src: string, tokens?: Token[]): Token[];
|
|
556
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* Gets the original marked default options.
|
|
575
|
+
*/
|
|
557
576
|
declare function _getDefaults(): MarkedOptions;
|
|
558
577
|
declare let _defaults: MarkedOptions;
|
|
559
578
|
export type MaybePromise = void | Promise<void>;
|
|
@@ -594,7 +613,7 @@ export declare function marked(src: string, options: MarkedOptions & {
|
|
|
594
613
|
*
|
|
595
614
|
* @param src String of markdown source to be compiled
|
|
596
615
|
* @param options Optional hash of options
|
|
597
|
-
* @return String of compiled HTML.
|
|
616
|
+
* @return String of compiled HTML. Will be a Promise of string if async is set to true by any extensions.
|
|
598
617
|
*/
|
|
599
618
|
export declare function marked(src: string, options?: MarkedOptions): string | Promise<string>;
|
|
600
619
|
export declare namespace marked {
|
package/lib/marked.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* marked v12.0.
|
|
2
|
+
* marked v12.0.2 - a markdown parser
|
|
3
3
|
* Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
|
|
4
4
|
* https://github.com/markedjs/marked
|
|
5
5
|
*/
|
|
@@ -322,7 +322,9 @@ class _Tokenizer {
|
|
|
322
322
|
blockquote(src) {
|
|
323
323
|
const cap = this.rules.block.blockquote.exec(src);
|
|
324
324
|
if (cap) {
|
|
325
|
-
|
|
325
|
+
// precede setext continuation with 4 spaces so it isn't a setext
|
|
326
|
+
let text = cap[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, '\n $1');
|
|
327
|
+
text = rtrim(text.replace(/^ *>[ \t]?/gm, ''), '\n');
|
|
326
328
|
const top = this.lexer.state.top;
|
|
327
329
|
this.lexer.state.top = true;
|
|
328
330
|
const tokens = this.lexer.blockTokens(text);
|
|
@@ -916,8 +918,13 @@ const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\
|
|
|
916
918
|
const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
917
919
|
const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
918
920
|
const bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
919
|
-
const lheading = edit(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/)
|
|
921
|
+
const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/)
|
|
920
922
|
.replace(/bull/g, bullet) // lists can interrupt
|
|
923
|
+
.replace(/blockCode/g, / {4}/) // indented code blocks can interrupt
|
|
924
|
+
.replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt
|
|
925
|
+
.replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt
|
|
926
|
+
.replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt
|
|
927
|
+
.replace(/html/g, / {0,3}<[^\n>]+>\n/) // block html can interrupt
|
|
921
928
|
.getRegex();
|
|
922
929
|
const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
923
930
|
const blockText = /^[^\n]+/;
|
|
@@ -953,7 +960,7 @@ const html = edit('^ {0,3}(?:' // optional indentation
|
|
|
953
960
|
const paragraph = edit(_paragraph)
|
|
954
961
|
.replace('hr', hr)
|
|
955
962
|
.replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
|
|
956
|
-
.replace('|lheading', '') //
|
|
963
|
+
.replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
|
|
957
964
|
.replace('|table', '')
|
|
958
965
|
.replace('blockquote', ' {0,3}>')
|
|
959
966
|
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
|
@@ -1003,7 +1010,7 @@ const blockGfm = {
|
|
|
1003
1010
|
paragraph: edit(_paragraph)
|
|
1004
1011
|
.replace('hr', hr)
|
|
1005
1012
|
.replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
|
|
1006
|
-
.replace('|lheading', '') //
|
|
1013
|
+
.replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
|
|
1007
1014
|
.replace('table', gfmTable) // interrupt paragraphs with table
|
|
1008
1015
|
.replace('blockquote', ' {0,3}>')
|
|
1009
1016
|
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|