GridTable Parser - wrong behavior if with space occurs in table borders #595

Open
opened 2026-01-29 14:40:37 +00:00 by claunia · 3 comments
Owner

Originally created by @RedCali on GitHub (Feb 28, 2023).

GridTable Parser - wrong behavior if with space occurs in table borders
Th with space leads into an inserted horizontal row:

Source:

#### Rendering Issue WithSpace
+ :-----: +--------------------+---------------------+
| No.     | component          | comp. no.           
+=========+====================+=====================+
| 1       | component 1        | xxxx-xxxx-xxxx      
+ --------+--------------------+                     
| 2       | component 2        | xxxx-xxxx-xxxx   

Result:

<table>
<colgroup><col style="width:18%">
<col style="width:40%">
<col style="width:42%">
</colgroup>
<thead>
<tr>
<th style="text-align: center;">No.</th>
<th>component</th>
<th>comp. no.</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;">1</td>
<td>component 1</td>
<td rowspan="2">xxxx-xxxx-xxxx
xxxx-xxxx-xxxx</td>
</tr>
<tr>
<td style="text-align: center;">
<hr>
<p>2</p>
</td>
<td>component 2</td>
</tr>
</tbody>
</table>
```^

![image](https://user-images.githubusercontent.com/36916361/221905448-e39e813b-9054-4760-b539-46a209e6d79d.png)
Originally created by @RedCali on GitHub (Feb 28, 2023). GridTable Parser - wrong behavior if with space occurs in table borders Th with space leads into an inserted horizontal row: Source: ```md #### Rendering Issue WithSpace + :-----: +--------------------+---------------------+ | No. | component | comp. no. +=========+====================+=====================+ | 1 | component 1 | xxxx-xxxx-xxxx + --------+--------------------+ | 2 | component 2 | xxxx-xxxx-xxxx ``` Result: ```htm <table> <colgroup><col style="width:18%"> <col style="width:40%"> <col style="width:42%"> </colgroup> <thead> <tr> <th style="text-align: center;">No.</th> <th>component</th> <th>comp. no.</th> </tr> </thead> <tbody> <tr> <td style="text-align: center;">1</td> <td>component 1</td> <td rowspan="2">xxxx-xxxx-xxxx xxxx-xxxx-xxxx</td> </tr> <tr> <td style="text-align: center;"> <hr> <p>2</p> </td> <td>component 2</td> </tr> </tbody> </table> ```^ ![image](https://user-images.githubusercontent.com/36916361/221905448-e39e813b-9054-4760-b539-46a209e6d79d.png)
claunia added the question label 2026-01-29 14:40:37 +00:00
Author
Owner

@xoofx commented on GitHub (Mar 7, 2023):

Could you elaborate which space exactly?

@xoofx commented on GitHub (Mar 7, 2023): Could you elaborate which space exactly?
Author
Owner

@RedCali commented on GitHub (Mar 7, 2023):

Its the one between the two table lines 1 & 2 - the separator gets an whitespace after the + sign + --.... and the dashes after the with space interpreted as horizontal row.

Hard to say what's wrong or right here as the grid table has kind of hard def. and this will break it...
from user perspective it could be good if this signs could be ignored in the row separation started by +, but honestly I'm not sure which side effects will follow if this would be accepted

@RedCali commented on GitHub (Mar 7, 2023): Its the one between the two table lines 1 & 2 - the separator gets an whitespace after the `+` sign `+ --....` and the dashes after the with space interpreted as horizontal row. Hard to say what's wrong or right here as the grid table has kind of hard def. and this will break it... from user perspective it could be good if this signs could be ignored in the row separation started by `+`, but honestly I'm not sure which side effects will follow if this would be accepted
Author
Owner

@xoofx commented on GitHub (Mar 7, 2023):

Oh, ok, understood, thanks.

Let's say that it is by design and that it doesn't accept spaces between + 🙂

If you feel brave, PR welcome, the code is in GridTableParser.cs. As you said, there is no real standard for this. I haven't checked how e.g pandoc is behaving with such difference.

@xoofx commented on GitHub (Mar 7, 2023): Oh, ok, understood, thanks. Let's say that it is by design and that it doesn't accept spaces between `+` 🙂 If you feel brave, PR welcome, the code is in [GridTableParser.cs](https://github.com/xoofx/markdig/blob/master/src/Markdig/Extensions/Tables/GridTableParser.cs). As you said, there is no real standard for this. I haven't checked how e.g pandoc is behaving with such difference.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#595