Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ public BlockStart tryStart(ParserState state, MatchedBlockParser matchedBlockPar
if (columns != null && !columns.isEmpty()) {
SourceLine paragraph = paragraphLines.get(paragraphLines.size() - 1);
List<SourceLine> headerCells = split(paragraph);
if (columns.size() >= headerCells.size()) {
// spec: The header row must match the delimiter row in the number of cells.
// If not, a table will not be recognized
if (columns.size() == headerCells.size()) {
var parser = new TableBlockParser(columns, paragraph, maxCells);
return BlockStart.of(parser)
.atIndex(state.getIndex())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,32 @@ public void separatorMustNotHaveLessPartsThanHead() {
""");
}

@Test
public void separatorMustNotHaveMorePartsThanHead() {
assertRendering(
"""
Abc|Def
---|-|-
1|2
""",
"""
<p>Abc|Def
---|-|-
1|2</p>
""");
assertRendering(
"""
a|b|c
-|-|-|-
d|e|f
""",
"""
<p>a|b|c
-|-|-|-
d|e|f</p>
""");
}

@Test
public void padding() {
assertRendering(
Expand Down
Loading