marked 11.1.1 → 12.0.0

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/bin/main.js CHANGED
@@ -222,8 +222,7 @@ export async function main(nodeProcess) {
222
222
 
223
223
  if (output) {
224
224
  if (noclobber && await fileExists(output)) {
225
- nodeProcess.stderr.write('marked: output file \'' + output + '\' already exists, disable the \'-n\' / \'--no-clobber\' flag to overwrite\n');
226
- nodeProcess.exit(1);
225
+ throw Error('marked: output file \'' + output + '\' already exists, disable the \'-n\' / \'--no-clobber\' flag to overwrite\n');
227
226
  }
228
227
  return await writeFile(output, html);
229
228
  }
@@ -271,9 +270,10 @@ export async function main(nodeProcess) {
271
270
  nodeProcess.exit(0);
272
271
  } catch (err) {
273
272
  if (err.code === 'ENOENT') {
274
- nodeProcess.stderr.write('marked: output to ' + err.path + ': No such directory');
273
+ nodeProcess.stderr.write('marked: ' + err.path + ': No such file or directory');
274
+ } else {
275
+ nodeProcess.stderr.write(err.message);
275
276
  }
276
- nodeProcess.stderr.write(err);
277
277
  return nodeProcess.exit(1);
278
278
  }
279
279
  }
package/lib/marked.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * marked v11.1.1 - a markdown parser
3
- * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
2
+ * marked v12.0.0 - a markdown parser
3
+ * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
6
6
 
@@ -935,9 +935,9 @@ const _tag = 'address|article|aside|base|basefont|blockquote|body|caption'
935
935
  + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
936
936
  + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
937
937
  + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
938
- + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
939
- + '|track|ul';
940
- const _comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
938
+ + '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title'
939
+ + '|tr|track|ul';
940
+ const _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
941
941
  const html = edit('^ {0,3}(?:' // optional indentation
942
942
  + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
943
943
  + '|comment[^\\n]*(\\n+|$)' // (2)
@@ -1052,7 +1052,7 @@ const inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
1052
1052
  const br = /^( {2,}|\\)\n(?!\s*$)/;
1053
1053
  const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
1054
1054
  // list of unicode punctuation marks, plus any missing characters from CommonMark spec
1055
- const _punctuation = '\\p{P}$+<=>`^|~';
1055
+ const _punctuation = '\\p{P}\\p{S}';
1056
1056
  const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u')
1057
1057
  .replace(/punctuation/g, _punctuation).getRegex();
1058
1058
  // sequences em should skip over [title](link), `code`, <html>
@@ -2091,7 +2091,8 @@ class Marked {
2091
2091
  const genericToken = token;
2092
2092
  if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
2093
2093
  this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
2094
- values = values.concat(this.walkTokens(genericToken[childTokens], callback));
2094
+ const tokens = genericToken[childTokens].flat(Infinity);
2095
+ values = values.concat(this.walkTokens(tokens, callback));
2095
2096
  });
2096
2097
  }
2097
2098
  else if (genericToken.tokens) {