mdx-formatter

Type to search...

to open search from anywhere

Tables

How the formatter handles GFM tables and HTML tables

GFM (pipe-style) tables are preserved as-is. The formatter does not modify GFM table alignment or padding. HTML tables are handled by the formatHtmlBlocksInMdx option.

Rules

  • GFM (pipe-style) tables are preserved as-is
  • The formatter does not modify GFM table alignment or padding

Examples

HTML table indentation

HTML tables in MDX are formatted by the formatHtmlBlocksInMdx rule:

Before:

<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</tbody>
</table>

After:

<table>
  <thead>
    <tr>
      <th>Header 1</th>
      <th>Header 2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Data 1</td>
      <td>Data 2</td>
    </tr>
  </tbody>
</table>

Revision History