Files
pyth-on-line/src/lib/components/markdown/Table.svelte
Muspi Merol daf5cfe989 support more markdown features (#19)
* feat: support markdown tables

* chore: update `README.md`

* feat: support `blockquote`

---------

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2024-08-01 18:14:19 +08:00

38 lines
644 B
Svelte

<script lang="ts">
import type { Node, Table } from "mdast";
export let node: Node;
$: table = node as Table;
</script>
<table>
<thead>
<tr>
{#each table.children[0].children as cell}
<th>
{#each cell.children as child}
<slot {child} />
{/each}
</th>
{/each}
</tr>
</thead>
<tbody>
{#each table.children.slice(1) as row}
<tr>
{#each row.children as cell}
<td>
{#each cell.children as child}
<slot {child} />
{/each}
</td>
{/each}
</tr>
{/each}
</tbody>
</table>