marked 15.0.10 → 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.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * marked v15.0.10 - 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
  */
@@ -555,26 +555,17 @@ function outputLink(cap, link, raw, lexer, rules) {
555
555
  const href = link.href;
556
556
  const title = link.title || null;
557
557
  const text = cap[1].replace(rules.other.outputLinkReplace, '$1');
558
- if (cap[0].charAt(0) !== '!') {
559
- lexer.state.inLink = true;
560
- const token = {
561
- type: 'link',
562
- raw,
563
- href,
564
- title,
565
- text,
566
- tokens: lexer.inlineTokens(text),
567
- };
568
- lexer.state.inLink = false;
569
- return token;
570
- }
571
- return {
572
- type: 'image',
558
+ lexer.state.inLink = true;
559
+ const token = {
560
+ type: cap[0].charAt(0) === '!' ? 'image' : 'link',
573
561
  raw,
574
562
  href,
575
563
  title,
576
564
  text,
565
+ tokens: lexer.inlineTokens(text),
577
566
  };
567
+ lexer.state.inLink = false;
568
+ return token;
578
569
  }
579
570
  function indentCodeCompensation(raw, text, rules) {
580
571
  const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
@@ -1920,7 +1911,10 @@ class _Renderer {
1920
1911
  out += '>' + text + '</a>';
1921
1912
  return out;
1922
1913
  }
1923
- image({ href, title, text }) {
1914
+ image({ href, title, text, tokens }) {
1915
+ if (tokens) {
1916
+ text = this.parser.parseInline(tokens, this.parser.textRenderer);
1917
+ }
1924
1918
  const cleanHref = cleanUrl(href);
1925
1919
  if (cleanHref === null) {
1926
1920
  return escape(text);