marked 15.0.9 → 15.0.11

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
@@ -83,6 +83,7 @@ export declare namespace Tokens {
83
83
  href: string;
84
84
  title: string | null;
85
85
  text: string;
86
+ tokens: Token[];
86
87
  }
87
88
  interface Link {
88
89
  type: "link";
@@ -191,7 +192,7 @@ declare class _Renderer {
191
192
  br(token: Tokens.Br): string;
192
193
  del({ tokens }: Tokens.Del): string;
193
194
  link({ href, title, tokens }: Tokens.Link): string;
194
- image({ href, title, text }: Tokens.Image): string;
195
+ image({ href, title, text, tokens }: Tokens.Image): string;
195
196
  text(token: Tokens.Text | Tokens.Escape): string;
196
197
  }
197
198
  /**
package/lib/marked.d.ts CHANGED
@@ -83,6 +83,7 @@ export declare namespace Tokens {
83
83
  href: string;
84
84
  title: string | null;
85
85
  text: string;
86
+ tokens: Token[];
86
87
  }
87
88
  interface Link {
88
89
  type: "link";
@@ -191,7 +192,7 @@ declare class _Renderer {
191
192
  br(token: Tokens.Br): string;
192
193
  del({ tokens }: Tokens.Del): string;
193
194
  link({ href, title, tokens }: Tokens.Link): string;
194
- image({ href, title, text }: Tokens.Image): string;
195
+ image({ href, title, text, tokens }: Tokens.Image): string;
195
196
  text(token: Tokens.Text | Tokens.Escape): string;
196
197
  }
197
198
  /**
package/lib/marked.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * marked v15.0.9 - a markdown parser
2
+ * marked v15.0.11 - a markdown parser
3
3
  * Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
@@ -331,9 +331,9 @@ const tag = edit('^comment'
331
331
  .replace('attribute', /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/)
332
332
  .getRegex();
333
333
  const _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
334
- const link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/)
334
+ const link = edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/)
335
335
  .replace('label', _inlineLabel)
336
- .replace('href', /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/)
336
+ .replace('href', /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/)
337
337
  .replace('title', /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/)
338
338
  .getRegex();
339
339
  const reflink = edit(/^!?\[(label)\]\[(ref)\]/)
@@ -553,26 +553,17 @@ function outputLink(cap, link, raw, lexer, rules) {
553
553
  const href = link.href;
554
554
  const title = link.title || null;
555
555
  const text = cap[1].replace(rules.other.outputLinkReplace, '$1');
556
- if (cap[0].charAt(0) !== '!') {
557
- lexer.state.inLink = true;
558
- const token = {
559
- type: 'link',
560
- raw,
561
- href,
562
- title,
563
- text,
564
- tokens: lexer.inlineTokens(text),
565
- };
566
- lexer.state.inLink = false;
567
- return token;
568
- }
569
- return {
570
- type: 'image',
556
+ lexer.state.inLink = true;
557
+ const token = {
558
+ type: cap[0].charAt(0) === '!' ? 'image' : 'link',
571
559
  raw,
572
560
  href,
573
561
  title,
574
562
  text,
563
+ tokens: lexer.inlineTokens(text),
575
564
  };
565
+ lexer.state.inLink = false;
566
+ return token;
576
567
  }
577
568
  function indentCodeCompensation(raw, text, rules) {
578
569
  const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
@@ -1918,7 +1909,10 @@ class _Renderer {
1918
1909
  out += '>' + text + '</a>';
1919
1910
  return out;
1920
1911
  }
1921
- image({ href, title, text }) {
1912
+ image({ href, title, text, tokens }) {
1913
+ if (tokens) {
1914
+ text = this.parser.parseInline(tokens, this.parser.textRenderer);
1915
+ }
1922
1916
  const cleanHref = cleanUrl(href);
1923
1917
  if (cleanHref === null) {
1924
1918
  return escape(text);