@changerawr/markdown 1.1.6 → 1.1.7

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/dist/index.js CHANGED
@@ -110,7 +110,7 @@ __export(index_exports, {
110
110
  module.exports = __toCommonJS(index_exports);
111
111
 
112
112
  // src/parser.ts
113
- var MarkdownParser = class {
113
+ var MarkdownParser = class _MarkdownParser {
114
114
  // Cache compiled regexes
115
115
  constructor(config) {
116
116
  this.rules = [];
@@ -323,7 +323,18 @@ var MarkdownParser = class {
323
323
  recursivelyParseBlockContent(token) {
324
324
  const blockTypes = ["alert", "blockquote", "list-item", "task-item"];
325
325
  if (blockTypes.includes(token.type) && token.content && token.content.trim()) {
326
- const children = this.parse(token.content);
326
+ let children;
327
+ if ((token.type === "list-item" || token.type === "task-item") && this.rules.some((r) => r.name === "list-item")) {
328
+ const parserWithoutListRule = new _MarkdownParser(this.config);
329
+ this.rules.forEach((rule) => {
330
+ if (rule.name !== "list-item" && rule.name !== "task-item") {
331
+ parserWithoutListRule.addRule(rule);
332
+ }
333
+ });
334
+ children = parserWithoutListRule.parse(token.content);
335
+ } else {
336
+ children = this.parse(token.content);
337
+ }
327
338
  return {
328
339
  ...token,
329
340
  children