Skip to content

Tables

GFM (GitHub Flavored Markdown) pipe tables are rendered using jspdf-autotable.

Syntax

markdown
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1   | Cell 2   | Cell 3   |
| Cell 4   | Cell 5   | Cell 6   |

How It Renders

  • Headers are rendered with bold styling
  • Table is automatically sized to fit within page.maxContentWidth
  • Cell content is text-only (inline formatting not supported in table cells)
  • Tables that exceed the page height trigger automatic page breaks

Customizing Table Styles

Pass jspdf-autotable options through the table option:

ts
const options = {
  // ...other options
  table: {
    theme: 'grid',              // 'striped' | 'grid' | 'plain'
    headStyles: {
      fillColor: [99, 102, 241],
      textColor: 255,
      fontStyle: 'bold',
    },
    bodyStyles: {
      fontSize: 10,
    },
    alternateRowStyles: {
      fillColor: [245, 245, 250],
    },
    margin: { left: 10, right: 10 },
  },
}

Relevant Options

OptionEffect
tableFull UserOptions from jspdf-autotable — controls theme, colors, fonts, margins
page.maxContentWidthMaximum table width

Try It

Interactive

Try this in the Playground — paste the markdown above and click Generate PDF.

Released under the MIT License.