Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: calculuschild/marked-extended-tables
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.0
Choose a base ref
...
head repository: calculuschild/marked-extended-tables
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ccc46e33f8ae8fa255360c1a8db9deca00f9e21f
Choose a head ref
  • 5 commits
  • 7 files changed
  • 2 contributors

Commits on Mar 10, 2025

  1. Copy the full SHA
    973dce2 View commit details
  2. Add build objects

    G-Ambatte committed Mar 10, 2025
    Copy the full SHA
    0305f8f View commit details
  3. Add incomplete row test

    G-Ambatte committed Mar 10, 2025
    Copy the full SHA
    842491f View commit details
  4. Merge pull request #497 from G-Ambatte/fixSkipEmptyRows

    fix: Fix crash caused by new skip empty row function
    calculuschild committed Mar 10, 2025
    Copy the full SHA
    18408d3 View commit details
  5. 2.0.1

    calculuschild committed Mar 10, 2025
    Copy the full SHA
    ccc46e3 View commit details
Showing with 26 additions and 6 deletions.
  1. +1 −1 lib/index.cjs
  2. +1 −1 lib/index.umd.js
  3. +2 −2 package-lock.json
  4. +1 −1 package.json
  5. +10 −0 spec/__snapshots__/index.test.js.snap
  6. +10 −0 spec/index.test.js
  7. +1 −1 src/index.js
2 changes: 1 addition & 1 deletion lib/index.cjs
Original file line number Diff line number Diff line change
@@ -195,7 +195,7 @@ const splitCells = (tableRow, count, prevRow = [], skipEmptyRows) => {
}

// If all cells have been merged, flag as an empty row
if (skipEmptyRows && cells.length === cells.filter((cell) => { return cell.rowspan === 0; }).length) {
if (cells.length > 0 && skipEmptyRows && cells.length === cells.filter((cell) => { return cell.rowspan === 0; }).length) {
cells[0].emptyRow = true;
for (i = 0; i < cells.length; i++) {
cells[i].rowSpanTarget.rowspan -= 1;
2 changes: 1 addition & 1 deletion lib/index.umd.js
Original file line number Diff line number Diff line change
@@ -199,7 +199,7 @@
}

// If all cells have been merged, flag as an empty row
if (skipEmptyRows && cells.length === cells.filter((cell) => { return cell.rowspan === 0; }).length) {
if (cells.length > 0 && skipEmptyRows && cells.length === cells.filter((cell) => { return cell.rowspan === 0; }).length) {
cells[0].emptyRow = true;
for (i = 0; i < cells.length; i++) {
cells[i].rowSpanTarget.rowspan -= 1;
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "marked-extended-tables",
"version": "2.0.0",
"version": "2.0.1",
"description": "extended Markdown tables for Marked.js",
"main": "./lib/index.cjs",
"module": "./src/index.js",
10 changes: 10 additions & 0 deletions spec/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -8,6 +8,16 @@ exports[`extended-table Column Spanning 1`] = `
</tr></tbody></table>"
`;
exports[`extended-table Incomplete Row 1`] = `
"<table><thead><tr><th>H1</th>
<th>H2</th>
</tr></thead><tbody><tr><td>Merge empty rows</td>
<td>Cell A</td>
</tr><tr><td></td>
<td></td>
</tr></tbody></table>"
`;
exports[`extended-table Multi-row headers 1`] = `
"<table><thead><tr><th colspan=2 rowspan=2>This header spans two columns <em>and</em> two rows </th>
<th>Header A</th>
10 changes: 10 additions & 0 deletions spec/index.test.js
Original file line number Diff line number Diff line change
@@ -83,6 +83,16 @@ describe('extended-table', () => {
`))).toMatchSnapshot();
});

test('Incomplete Row', () => {
marked.use(extendedTable({}));
expect(marked(trimLines(`
| H1 | H2 |
|-------------------|---------|
| Merge empty rows | Cell A |
|
`))).toMatchSnapshot();
});

test('Multi-row headers', () => {
marked.use(extendedTable());
expect(marked(trimLines(`
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -193,7 +193,7 @@ const splitCells = (tableRow, count, prevRow = [], skipEmptyRows) => {
}

// If all cells have been merged, flag as an empty row
if (skipEmptyRows && cells.length === cells.filter((cell) => { return cell.rowspan === 0; }).length) {
if (cells.length > 0 && skipEmptyRows && cells.length === cells.filter((cell) => { return cell.rowspan === 0; }).length) {
cells[0].emptyRow = true;
for (i = 0; i < cells.length; i++) {
cells[i].rowSpanTarget.rowspan -= 1;