@nullpinter/satteri-extended-table
v0.1.6
Published
Satteri plugin for extended table colspan and rowspan syntax
Maintainers
Readme
satteri-extended-table
Satteri plugin for the extended table syntax implemented by
remark-extended-table.
Install
pnpm i @nullpinter/satteri-extended-tableUsage
Enable GFM table parsing and register the plugin in mdastPlugins:
import { markdownToHtml } from "satteri";
import { extendedTable } from "satteri-extended-table";
const result = await markdownToHtml(markdown, {
features: { gfm: true },
mdastPlugins: [extendedTable({ colspanWithEmpty: true })],
});
console.log(result.html);Syntax
The plugin follows remark-extended-table semantics:
^merges with the cell above it and creates arowspan.>merges with the cell to the right and creates acolspan.- Empty cells can merge with the left cell when
colspanWithEmptyis enabled.
Example:
| a | b |
| --- | --- |
| 1 | 2 |
| ^ | 3 |Output:
<table>
<thead>
<tr>
<th>a</th>
<th>b</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2">1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
</tr>
</tbody>
</table>Notes
- This is an MDAST plugin. Use it in
mdastPlugins, nothastPlugins. features.gfmmust be enabled so Satteri parses Markdown tables before this plugin runs.
