russross / blackfriday

Blackfriday: a markdown processor for Go
Other
5.42k stars 598 forks source link

Cannot render table with trailing whitespace #553

Open ialidzhikov opened 5 years ago

ialidzhikov commented 5 years ago

blackfriday does not properly renders markdown table that has a trailing whitespace in the header line. However the same table is properly rendered in github.

Steps to reproduce:

# 1. go get
$ go get github.com/russross/blackfriday-tool

# 2. Create a file that has a trailing whitespace after the first row.
$ cat table-with-space.md
| First Header  | Second Header | <- note the trailing space here
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |

# 3. Ensure that no table is rendered.
$ blackfriday-tool table-with-space.md
<p>| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |</p>

# 4. Ensure that it succeeds when there is no trailing whitespace
$ cat table-without-space.md
| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |
$ blackfriday-tool table-without-space.md
<table>
<thead>
<tr>
<th>First Header</th>
<th>Second Header</th>
</tr>
</thead>

<tbody>
<tr>
<td>Content Cell</td>
<td>Content Cell</td>
</tr>

<tr>
<td>Content Cell</td>
<td>Content Cell</td>
</tr>
</tbody>
</table>