Browse Source

Don't add tabs to tables markup

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
5412189997
  1. 10
      lib/renderer.js
  2. 80
      test/fixtures/remarkable/tables.txt

10
lib/renderer.js

@ -141,19 +141,19 @@ rules.table_close = function (/*tokens, idx, options*/) {
return '</table>\n'; return '</table>\n';
}; };
rules.thead_open = function (/*tokens, idx, options*/) { rules.thead_open = function (/*tokens, idx, options*/) {
return '\t<thead>\n'; return '<thead>\n';
}; };
rules.thead_close = function (/*tokens, idx, options*/) { rules.thead_close = function (/*tokens, idx, options*/) {
return '\t</thead>\n'; return '</thead>\n';
}; };
rules.tbody_open = function (/*tokens, idx, options*/) { rules.tbody_open = function (/*tokens, idx, options*/) {
return '\t<tbody>\n'; return '<tbody>\n';
}; };
rules.tbody_close = function (/*tokens, idx, options*/) { rules.tbody_close = function (/*tokens, idx, options*/) {
return '\t</tbody>\n'; return '</tbody>\n';
}; };
rules.tr_open = function (/*tokens, idx, options*/) { rules.tr_open = function (/*tokens, idx, options*/) {
return '\t\t<tr>'; return '<tr>';
}; };
rules.tr_close = function (/*tokens, idx, options*/) { rules.tr_close = function (/*tokens, idx, options*/) {
return '</tr>\n'; return '</tr>\n';

80
test/fixtures/remarkable/tables.txt

@ -7,13 +7,13 @@ Tests from marked:
| Cell 3 | Cell 4 | Cell 3 | Cell 4
. .
<table> <table>
<thead> <thead>
<tr><th>Heading 1</th><th>Heading 2</th></tr> <tr><th>Heading 1</th><th>Heading 2</th></tr>
</thead> </thead>
<tbody> <tbody>
<tr><td>Cell 1</td><td>Cell 2</td></tr> <tr><td>Cell 1</td><td>Cell 2</td></tr>
<tr><td>Cell 3</td><td>Cell 4</td></tr> <tr><td>Cell 3</td><td>Cell 4</td></tr>
</tbody> </tbody>
</table> </table>
. .
@ -24,13 +24,13 @@ Tests from marked:
| Cell 5 | Cell 6 | Cell 7 | Cell 8 | | Cell 5 | Cell 6 | Cell 7 | Cell 8 |
. .
<table> <table>
<thead> <thead>
<tr><th style="text-align:center">Header 1</th><th style="text-align:right">Header 2</th><th style="text-align:left">Header 3</th><th>Header 4</th></tr> <tr><th style="text-align:center">Header 1</th><th style="text-align:right">Header 2</th><th style="text-align:left">Header 3</th><th>Header 4</th></tr>
</thead> </thead>
<tbody> <tbody>
<tr><td style="text-align:center">Cell 1</td><td style="text-align:right">Cell 2</td><td style="text-align:left">Cell 3</td><td>Cell 4</td></tr> <tr><td style="text-align:center">Cell 1</td><td style="text-align:right">Cell 2</td><td style="text-align:left">Cell 3</td><td>Cell 4</td></tr>
<tr><td style="text-align:center">Cell 5</td><td style="text-align:right">Cell 6</td><td style="text-align:left">Cell 7</td><td>Cell 8</td></tr> <tr><td style="text-align:center">Cell 5</td><td style="text-align:right">Cell 6</td><td style="text-align:left">Cell 7</td><td>Cell 8</td></tr>
</tbody> </tbody>
</table> </table>
. .
@ -41,13 +41,13 @@ Cell 1 | Cell 2
Cell 3 | Cell 4 Cell 3 | Cell 4
. .
<table> <table>
<thead> <thead>
<tr><th>Header 1</th><th>Header 2</th></tr> <tr><th>Header 1</th><th>Header 2</th></tr>
</thead> </thead>
<tbody> <tbody>
<tr><td>Cell 1</td><td>Cell 2</td></tr> <tr><td>Cell 1</td><td>Cell 2</td></tr>
<tr><td>Cell 3</td><td>Cell 4</td></tr> <tr><td>Cell 3</td><td>Cell 4</td></tr>
</tbody> </tbody>
</table> </table>
. .
@ -58,13 +58,13 @@ Cell 1 |Cell 2 |Cell 3 |Cell 4
*Cell 5*|Cell 6 |Cell 7 |Cell 8 *Cell 5*|Cell 6 |Cell 7 |Cell 8
. .
<table> <table>
<thead> <thead>
<tr><th style="text-align:left">Header 1</th><th style="text-align:center">Header 2</th><th style="text-align:right">Header 3</th><th>Header 4</th></tr> <tr><th style="text-align:left">Header 1</th><th style="text-align:center">Header 2</th><th style="text-align:right">Header 3</th><th>Header 4</th></tr>
</thead> </thead>
<tbody> <tbody>
<tr><td style="text-align:left">Cell 1</td><td style="text-align:center">Cell 2</td><td style="text-align:right">Cell 3</td><td>Cell 4</td></tr> <tr><td style="text-align:left">Cell 1</td><td style="text-align:center">Cell 2</td><td style="text-align:right">Cell 3</td><td>Cell 4</td></tr>
<tr><td style="text-align:left"><em>Cell 5</em></td><td style="text-align:center">Cell 6</td><td style="text-align:right">Cell 7</td><td>Cell 8</td></tr> <tr><td style="text-align:left"><em>Cell 5</em></td><td style="text-align:center">Cell 6</td><td style="text-align:right">Cell 7</td><td>Cell 8</td></tr>
</tbody> </tbody>
</table> </table>
. .
@ -78,12 +78,12 @@ baz|baz
. .
<blockquote> <blockquote>
<table> <table>
<thead> <thead>
<tr><th>foo</th><th>foo</th></tr> <tr><th>foo</th><th>foo</th></tr>
</thead> </thead>
<tbody> <tbody>
<tr><td>bar</td><td>bar</td></tr> <tr><td>bar</td><td>bar</td></tr>
</tbody> </tbody>
</table> </table>
</blockquote> </blockquote>
<p>baz|baz</p> <p>baz|baz</p>
@ -99,12 +99,12 @@ Nested tables inside lists:
. .
<ul> <ul>
<li><table> <li><table>
<thead> <thead>
<tr><th>foo</th><th>foo</th></tr> <tr><th>foo</th><th>foo</th></tr>
</thead> </thead>
<tbody> <tbody>
<tr><td>bar</td><td>bar</td></tr> <tr><td>bar</td><td>bar</td></tr>
</tbody> </tbody>
</table> </table>
</li> </li>
</ul> </ul>

Loading…
Cancel
Save