diff --git a/flexmark-html2md-converter/src/test/resources/flexmark_html_converter_spec.md b/flexmark-html2md-converter/src/test/resources/flexmark_html_converter_spec.md index eff2e6781..9537c9910 100644 --- a/flexmark-html2md-converter/src/test/resources/flexmark_html_converter_spec.md +++ b/flexmark-html2md-converter/src/test/resources/flexmark_html_converter_spec.md @@ -3010,6 +3010,44 @@ tables with row span cells ```````````````````````````````` +table where some rows end with colspan 0 + +```````````````````````````````` example Tables: 51 +| Abc | Def | +|---------|-----| +| no span | span + +. + + + + + + + +
AbcDef
no spanspan
+```````````````````````````````` + + +table where all rows end with colspan 0 + +```````````````````````````````` example Tables: 52 +| Abc | Def +|---------|-----| +| no span | span + +. + + + + + + + +
AbcDef
no spanspan
+```````````````````````````````` + + ## Definition Lists a definition in a block quote diff --git a/flexmark-util-format/src/main/java/com/vladsch/flexmark/util/format/TableRow.java b/flexmark-util-format/src/main/java/com/vladsch/flexmark/util/format/TableRow.java index 6a6d7f4bd..00d6ae114 100644 --- a/flexmark-util-format/src/main/java/com/vladsch/flexmark/util/format/TableRow.java +++ b/flexmark-util-format/src/main/java/com/vladsch/flexmark/util/format/TableRow.java @@ -6,6 +6,7 @@ import java.util.List; import static com.vladsch.flexmark.util.format.TableCellManipulator.BREAK; +import static com.vladsch.flexmark.util.misc.Utils.max; import static com.vladsch.flexmark.util.misc.Utils.maxLimit; import static com.vladsch.flexmark.util.misc.Utils.minLimit; @@ -97,7 +98,7 @@ public int getSpannedColumns() { int columns = 0; for (TableCell cell : cells) { if (cell == null) continue; - columns += cell.columnSpan; + columns += max(cell.columnSpan, 1); } return columns; }