mirror of
https://github.com/promplate/pyth-on-line.git
synced 2025-09-06 20:53:20 +00:00

* 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>
38 lines
644 B
Svelte
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>
|