marked 11.1.0 → 11.2.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.0 - a markdown parser
3
- * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
2
+ * marked v11.2.0 - a markdown parser
3
+ * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
6
6
 
@@ -1262,10 +1262,11 @@ class _Lexer {
1262
1262
  src = src
1263
1263
  .replace(/\r\n|\r/g, '\n');
1264
1264
  this.blockTokens(src, this.tokens);
1265
- let next;
1266
- while (next = this.inlineQueue.shift()) {
1265
+ for (let i = 0; i < this.inlineQueue.length; i++) {
1266
+ const next = this.inlineQueue[i];
1267
1267
  this.inlineTokens(next.src, next.tokens);
1268
1268
  }
1269
+ this.inlineQueue = [];
1269
1270
  return this.tokens;
1270
1271
  }
1271
1272
  blockTokens(src, tokens = []) {
@@ -2090,7 +2091,8 @@ class Marked {
2090
2091
  const genericToken = token;
2091
2092
  if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
2092
2093
  this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
2093
- values = values.concat(this.walkTokens(genericToken[childTokens], callback));
2094
+ const tokens = genericToken[childTokens].flat(Infinity);
2095
+ values = values.concat(this.walkTokens(tokens, callback));
2094
2096
  });
2095
2097
  }
2096
2098
  else if (genericToken.tokens) {