fix: spaces on a newline after a table (#2319)

* fix: rename inconsistent function

* fix: newline with 1~4 spaces below table

* fix: format html test

* fix: specify spaces only

* fix: specify spaces only

* fix: detect tab

* fix: detect tab

* fix: newline at the end of html
This commit is contained in:
Chell
2021-12-18 18:21:22 -06:00
committed by GitHub
parent fbc08fb18d
commit f82ea2cf1b
3 changed files with 51 additions and 1 deletions
+1 -1
View File
@@ -355,7 +355,7 @@ export class Tokenizer {
type: 'table',
header: splitCells(cap[1]).map(c => { return { text: c }; }),
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
rows: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
rows: cap[3] ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
};
if (item.header.length === item.align.length) {
+38
View File
@@ -0,0 +1,38 @@
<table>
<thead>
<tr>
<th>y</th>
</tr>
</thead>
<tbody>
<tr>
<td>x</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>y</th>
</tr>
</thead>
<tbody>
<tr>
<td>x</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>y</th>
</tr>
</thead>
<tbody>
<tr>
<td>x</td>
</tr>
</tbody>
</table>
<pre><code>code
</code></pre>
+12
View File
@@ -0,0 +1,12 @@
| y |
| - |
| x |
| y |
| - |
| x |
| y |
| - |
| x |
code