Skip to content
Merged
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
20 changes: 20 additions & 0 deletions src/Markdig.Tests/MiscTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,26 @@ public void RootInlineInTableCellHasCorrectSourceSpan()
Assert.That(paragraph.Inline.Span.End == paragraph.Inline.LastChild.Span.End);
}

[Test]
public void TestGridTableShortLine()
{
var input = @"
+--+
| |
+-";

var expected = @"<table>
<col style=""width:100%"" />
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
";
TestParser.TestSpec(input, expected, new MarkdownPipelineBuilder().UseGridTables().Build());
}

[Test]
public void TestDefinitionListInListItemWithBlankLine()
{
Expand Down
3 changes: 2 additions & 1 deletion src/Markdig/Extensions/Tables/GridTableParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,15 @@ private BlockState HandleNewRow(BlockProcessor processor, GridTableState tableSt
private static void SetRowSpanState(List<GridTableState.ColumnSlice> columns, StringSlice line, out bool isHeaderRow, out bool hasRowSpan)
{
var lineStart = line.Start;
var lineEnd = line.End;
isHeaderRow = line.PeekChar() == '=' || line.PeekChar(2) == '=';
hasRowSpan = false;
foreach (var columnSlice in columns)
{
if (columnSlice.CurrentCell != null)
{
line.Start = lineStart + columnSlice.Start + 1;
line.End = lineStart + columnSlice.End - 1;
line.End = Math.Min(lineStart + columnSlice.End - 1, lineEnd);
line.Trim();
if (line.IsEmptyOrWhitespace() || !IsRowSeparator(line))
{
Expand Down
Loading