marked 11.2.0 → 12.0.1

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- // Generated by dts-bundle-generator v9.2.4
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. Wil be a Promise of string if async is set to true by any extensions.
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.2.4
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. Wil be a Promise of string if async is set to true by any extensions.
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 v11.2.0 - a markdown parser
2
+ * marked v12.0.1 - a markdown parser
3
3
  * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
@@ -916,8 +916,13 @@ const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\
916
916
  const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
917
917
  const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
918
918
  const bullet = /(?:[*+-]|\d{1,9}[.)])/;
919
- const lheading = edit(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/)
919
+ const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/)
920
920
  .replace(/bull/g, bullet) // lists can interrupt
921
+ .replace(/blockCode/g, / {4}/) // indented code blocks can interrupt
922
+ .replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt
923
+ .replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt
924
+ .replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt
925
+ .replace(/html/g, / {0,3}<[^\n>]+>\n/) // block html can interrupt
921
926
  .getRegex();
922
927
  const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
923
928
  const blockText = /^[^\n]+/;
@@ -933,9 +938,9 @@ const _tag = 'address|article|aside|base|basefont|blockquote|body|caption'
933
938
  + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
934
939
  + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
935
940
  + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
936
- + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
937
- + '|track|ul';
938
- const _comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
941
+ + '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title'
942
+ + '|tr|track|ul';
943
+ const _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
939
944
  const html = edit('^ {0,3}(?:' // optional indentation
940
945
  + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
941
946
  + '|comment[^\\n]*(\\n+|$)' // (2)
@@ -1050,7 +1055,7 @@ const inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
1050
1055
  const br = /^( {2,}|\\)\n(?!\s*$)/;
1051
1056
  const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
1052
1057
  // list of unicode punctuation marks, plus any missing characters from CommonMark spec
1053
- const _punctuation = '\\p{P}$+<=>`^|~';
1058
+ const _punctuation = '\\p{P}\\p{S}';
1054
1059
  const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u')
1055
1060
  .replace(/punctuation/g, _punctuation).getRegex();
1056
1061
  // sequences em should skip over [title](link), `code`, <html>