markdoc-pdf 0.11.1

Render Markdoc documents to PDF, as a CLI or a library
Documentation
---
title: Markdoc list-syntax tables
---

# Markdoc list-syntax tables

The Markdoc list-syntax table (cells as `*` items, rows separated by `---`)
builds the same table structure as a Markdown pipe table. The first row is the
header unless the table starts with `---`.

## Basic

{% table %}
* Heading 1
* Heading 2
---
* Row 1 Cell 1
* Row 1 Cell 2
---
* Row 2 Cell 1
* Row 2 Cell 2
{% /table %}

## Without a header

{% table %}
---
* foo
* bar
---
* foo
* bar
{% /table %}

## Rich content in cells

Cells are parsed as Markdown, so they can hold code, lists, and paragraphs —
including a `list` tag with a custom marker.

{% table %}
* Foo
* Bar
* Baz
---
*
  ```
  puts "code here"
  ```
*
  {% list type="checkmark" %}
  * Bulleted list in table
  * Second item
  {% /list %}
* Text in a table
{% /table %}

## Images in cells

Images work in cells too — reference them by `src` or asset `id`, and use the
`size` preset (`small` = 50 %, `medium` = 75 %, `large` = 100 % of the cell
width) to keep thumbnails in check. A cell can mix an image with a nested
list, like a parts table (render with `--assets-root examples`):

{% table %}
* Image
* Part
* Fits
* Order
---
* {% media src="swatch.png" size="small" /%}
* NMC Battery Rev. 10
* ACME2, ACME4
* 000001
---
* {% media src="sample.jpg" size="small" /%}
* NMC Battery Rev. 3
*
  * ACME1, ACME3, ACME5
  * All ACME6 units
* 000002
---
*
* LFP Battery Rev. 5
*
*
{% /table %}

## Column alignment

An `align` annotation on a header cell aligns the whole column; an `align` on
a body cell overrides just that cell.

{% table %}
* Left
* Centre {% align="center" %}
* Right {% align="right" %}
---
* foo
* bar
* baz
---
* longer text
* bar {% align="right" %}
* 1,234
{% /table %}

## Spanning columns

A `colspan` annotation on a cell merges it across columns (no internal rule).

{% table %}
* A
* B
* C
---
* one
* two
* three
---
* spans the first two columns {% colspan=2 %}
* C
{% /table %}

## Spanning rows

A `rowspan` annotation merges a cell down across rows.

{% table %}
* Name
* Detail
---
* Shared across rows {% rowspan=2 %}
* first detail
---
* second detail
{% /table %}