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.umd.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
  */
@@ -337,9 +337,9 @@
337
337
  .replace('attribute', /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/)
338
338
  .getRegex();
339
339
  const _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
340
- const link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/)
340
+ const link = edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/)
341
341
  .replace('label', _inlineLabel)
342
- .replace('href', /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/)
342
+ .replace('href', /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/)
343
343
  .replace('title', /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/)
344
344
  .getRegex();
345
345
  const reflink = edit(/^!?\[(label)\]\[(ref)\]/)
@@ -559,26 +559,17 @@
559
559
  const href = link.href;
560
560
  const title = link.title || null;
561
561
  const text = cap[1].replace(rules.other.outputLinkReplace, '$1');
562
- if (cap[0].charAt(0) !== '!') {
563
- lexer.state.inLink = true;
564
- const token = {
565
- type: 'link',
566
- raw,
567
- href,
568
- title,
569
- text,
570
- tokens: lexer.inlineTokens(text),
571
- };
572
- lexer.state.inLink = false;
573
- return token;
574
- }
575
- return {
576
- type: 'image',
562
+ lexer.state.inLink = true;
563
+ const token = {
564
+ type: cap[0].charAt(0) === '!' ? 'image' : 'link',
577
565
  raw,
578
566
  href,
579
567
  title,
580
568
  text,
569
+ tokens: lexer.inlineTokens(text),
581
570
  };
571
+ lexer.state.inLink = false;
572
+ return token;
582
573
  }
583
574
  function indentCodeCompensation(raw, text, rules) {
584
575
  const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
@@ -1924,7 +1915,10 @@
1924
1915
  out += '>' + text + '</a>';
1925
1916
  return out;
1926
1917
  }
1927
- image({ href, title, text }) {
1918
+ image({ href, title, text, tokens }) {
1919
+ if (tokens) {
1920
+ text = this.parser.parseInline(tokens, this.parser.textRenderer);
1921
+ }
1928
1922
  const cleanHref = cleanUrl(href);
1929
1923
  if (cleanHref === null) {
1930
1924
  return escape(text);