Skip to main content

Text: Html Table To SVG

Convert an HTML <table> into a self-contained SVG rendering.

The first <table> in the input is parsed and its cells are laid out in a regular grid, with each column sized from its longest text (capped at 48 characters — longer content wraps onto extra lines so one long paragraph cannot blow the table out). Header cells (<th>) — and the first row of tables that only use <td> — get a tinted background and bold text.

Inline markup inside cells is stripped, common HTML entities are decoded, and colspan/rowspan attributes are ignored. The node fails when the input contains no <table> with at least one non-empty row.

Example
Input: <table><tr><th>A</th><th>B</th></tr><tr><td>1</td><td>2</td></tr></table>
Output: <svg xmlns="http://www.w3.org/2000/svg" ...>...</svg>

Parameters

Font size (px)

Pixel size used for cell text in the generated SVG. Defaults to 14.

Cell padding (px)

Pixel padding applied inside every cell of the rendered SVG. Defaults to 8.

Input

Textrequired

The HTML text containing the table to render. Only the first <table> element is used.

Output

Text

The rendered table as a self-contained <svg>...</svg> document.