Skip to main content

Writer Options

Each output format has a small set of options. Every binding takes them the same way, as a JSON object (a dict in Python, a named list in R); anything you leave out keeps its default. Unknown option names, wrong types and out-of-range values are errors, not silently ignored. gridwell formats --json (CLI), gridwell.formats() (Python) and gw_formats() (R) list every format with its options and defaults.

gridwell convert table.json --to latex --options '{"booktabs": false}'
gridwell convert table.json --to html --options-file html-options.json
table.render("latex", {"booktabs": False})
table.render_latex(booktabs=False)          # same, as keyword arguments
gw_render(tbl, "latex", list(booktabs = FALSE))
gw_render_latex(tbl, booktabs = FALSE)      # same, as named arguments
gw_render(tbl, "latex", '{"booktabs": false}')
gridwell_render_text_with_options(table, "latex", "{\"booktabs\": false}", &err);
let options = serde_json::json!({ "booktabs": false });
gridwell_render::render(&table, "latex", Some(&options))?;

Options of every format

Option Type Default Meaning
raw boolean true Write the markup of raw nodes as it is. Pass false for IR you don’t trust. Then raw HTML is drawn as text and styled runs in every format, HTML included, the way formats other than HTML always draw it. Raw markup for other formats is dropped. No markup from the IR reaches the output unchecked
gridwell convert table.json --to html --options '{"raw": false}'

Options by format

RTF, Pandoc and DOCX have no options of their own; they accept only raw (or no options at all).

html

Option Type Default Meaning
inline_styles boolean false Put styles in style="…" attributes instead of a <style> block with classes
pretty_print boolean true Indent the markup, one element per line
class_prefix string "gw" Prefix for generated class names; letters, digits, _ and -, not starting with a digit or -
base_styles boolean true Include gridwell’s default look, modeled on gt’s (fonts, rules, padding). Its rules have zero specificity, so the table’s own styles and the host page’s CSS override them. false gives a bare fragment styled only by the table’s styles. Not applied with inline_styles
table_id string or null null The table’s id, as in gt’s gt(id =) and Great Tables’ GT(id=): the container’s id, and the prefix ({table_id}-) of every id the writer makes, so several tables on one page don’t share ids, and the scope of every rule in the <style> block, so they don’t share styles either. Not empty, and without whitespace
standalone boolean false Write a complete document (<!doctype html>, <meta charset="utf-8">, a <title> from the table’s title, lang from the locale) around the fragment, for a file opened on its own. Saving to .html doesn’t turn it on; pass it
quarto_disable_processing boolean false Mark the <table> data-quarto-disable-processing="true", as gt’s quarto.disable_processing, so Quarto leaves it as written rather than rewriting it with Bootstrap’s table classes (whose padding, rules and striping restyle it). A table shown in a Quarto or R Markdown document, or a notebook, has it on

latex

Option Type Default Meaning
booktabs boolean true Use booktabs rules (\toprule, \midrule, \bottomrule) instead of \hline
longtable boolean false Always use longtable (page-breaking) instead of tabular
longtable_threshold integer or null 30 Switch to longtable when there are more body rows than this; null never switches

typst

Option Type Default Meaning
repeat_header boolean true Wrap the column labels in table.header(…) so they repeat on every page

svg

Option Type Default Meaning
font_family string "Roboto, Helvetica, Arial, 'Liberation Sans', Arimo, sans-serif" CSS font list for all text; letters, digits, spaces, quotes and , - _ . only. Layout uses Roboto’s widths (and leaves room for Arial-compatible fallbacks), and every line of text Roboto has is drawn with textLength, so viewers that substitute another font keep the layout; a list without Roboto or an Arial-compatible font may not fit as well in viewers that ignore textLength (librsvg)
font_size number 16 Base font size in px (greater than 0, at most 10000)
row_height number 0 Minimum row height in px (0–10000); 0: rows are as tall as their content
cell_padding_x number 5 Horizontal padding of body cells in px (0–10000); column labels and spanners use the default look’s own
cell_padding_y number 8 Vertical padding of body cells in px (0–10000)
default_col_width number 120 Heading and note lines wrap at the larger of the table’s width and eight times this, in px (about a page)
base_styles boolean true Draw gridwell’s default look, the same as HTML’s base stylesheet (gt’s rules, padding, sizes and text color); the table’s own styles still win. false: no rules and black text, same layout

ansi

Option Type Default Meaning
box_drawing boolean true Draw borders with Unicode box-drawing characters and footnote marks as superscripts (false: ASCII +, -, |, and marks as plain text)
true_color boolean true Color text with 24-bit escape codes
max_width integer 0 Shrink the widest columns until the grid fits this many terminal columns (cells are cut with …); 0 means no limit
background_colors boolean false Paint cell backgrounds (fills and striping) with 24-bit escapes; needs true_color. Off by default because fills meant for light pages show as bright bars on dark terminals
color boolean true Emit ANSI escape codes (bold, italic, colors); false gives plain text for files, logs and diffs. Saving to a file defaults it to false unless you set it

quarto

Option Type Default Meaning
table_id string or null null Cross-reference id; the wrapper Div gets id tbl-<table_id>
extra_attrs list of [key, value] pairs [] Extra attributes on the wrapper Div

xlsx

Option Type Default Meaning
base_styles boolean true Draw the rules of gridwell’s default look as cell borders, the same as HTML’s base stylesheet (gt’s rules: the table’s top and bottom, under the column labels, between rows, around group labels, right of the stub, under spanners, above the title and below the notes, and a double rule above the grand summary), and hide the sheet’s gridlines; the table’s own borders still win. false: only the table’s own borders, over the gridlines

pptx

Option Type Default Meaning
base_styles boolean true Draw the rules of gridwell’s default look, the same as HTML’s base stylesheet (gt’s rules: the table’s top and bottom, under the column labels, between rows, around group labels, right of the stub, under spanners, above the title and below the notes, and a double rule above the grand summary); the table’s own borders still win. false: only the table’s own borders, same layout