@minamorl/markdown-next 2.2.2 → 2.2.3

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/src/parser.js CHANGED
@@ -155,19 +155,21 @@ class Parser {
155
155
  return content.trim();
156
156
  };
157
157
  // Table parser
158
- const table = P.seqMap(tableRowLine.skip(linebreak), tableRowLine.skip(linebreak), tableRowLine.skip(linebreak.atMost(1)).atLeast(0), (headerLine, sepLine, bodyLines) => {
158
+ // Use .chain() for validation instead of returning P.makeFailure from seqMap callback,
159
+ // since seqMap treats the return value as a successful parse result (not a parser control signal).
160
+ const table = P.seq(tableRowLine.skip(linebreak), tableRowLine.skip(linebreak), tableRowLine.skip(linebreak.atMost(1)).atLeast(0)).chain(([headerLine, sepLine, bodyLines]) => {
159
161
  // Validate separator row
160
162
  if (!isSeparatorRow(sepLine)) {
161
- return P.makeFailure(0, 'Not a valid table separator');
163
+ return P.fail('Not a valid table separator');
162
164
  }
163
165
  const headerCells = parseTableRow(headerLine);
164
166
  const bodyCells = bodyLines.map(parseTableRow);
165
167
  if (headerCells.length === 0) {
166
- return P.makeFailure(0, 'No header cells');
168
+ return P.fail('No header cells');
167
169
  }
168
170
  const headerRow = mapper('tr')(join(headerCells.map((h) => mapper('th')(parseCellContent(h)))));
169
171
  const bodyRows = bodyCells.map((row) => mapper('tr')(join(row.map((cell) => mapper('td')(parseCellContent(cell))))));
170
- return mapper('table')(join([headerRow, ...bodyRows]));
172
+ return P.succeed(mapper('table')(join([headerRow, ...bodyRows])));
171
173
  });
172
174
  const inlines = inline.atLeast(1).map(join);
173
175
  const paragraphBegin = inlines;
package/package.json CHANGED
@@ -46,5 +46,5 @@
46
46
  "url": "https://github.com/minamorl/markdown-next/issues"
47
47
  },
48
48
  "homepage": "https://github.com/minamorl/markdown-next#readme",
49
- "version": "2.2.2"
49
+ "version": "2.2.3"
50
50
  }