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
13 changes: 6 additions & 7 deletions parser/block_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ func (p *Parser) tableRow(data []byte, columns []ast.CellAlignFlags, header bool

cellStart := i

// If we are in a codespan we should discount any | we see, check for that here and skip ahead.
if i < n && data[i] == '`' {
if isCode, _ := codeSpan(p, data[i:], 0); isCode > 0 {
i += isCode - 1
}
}

for i < n && (data[i] != '|' || isBackslashEscaped(data, i)) && data[i] != '\n' {
// If we are in a codespan we should discount any | we see, check for that here and skip ahead.
if data[i] == '`' {
if isCode, _ := codeSpan(p, data[i:], 0); isCode > 0 {
i += isCode - 1
}
}
i++
}

Expand Down
60 changes: 60 additions & 0 deletions testdata/Table.tests
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,63 @@ c | `d|e`
</tr>
</tfoot>
</table>
+++
| a`|`b | c |
| --- | --- |
| x | y |
+++
<table>
<thead>
<tr>
<th>a<code>|</code>b</th>
<th>c</th>
</tr>
</thead>

<tbody>
<tr>
<td>x</td>
<td>y</td>
</tr>
</tbody>
</table>
+++
| h1 | h2 |
| --- | --- |
| x`|`y | z |
+++
<table>
<thead>
<tr>
<th>h1</th>
<th>h2</th>
</tr>
</thead>

<tbody>
<tr>
<td>x<code>|</code>y</td>
<td>z</td>
</tr>
</tbody>
</table>
+++
| h1 | h2 |
| --- | --- |
| x`|`| z |
+++
<table>
<thead>
<tr>
<th>h1</th>
<th>h2</th>
</tr>
</thead>

<tbody>
<tr>
<td>x<code>|</code></td>
<td>z</td>
</tr>
</tbody>
</table>
Loading