High-level table API built on top of the layout DSL.
Use this namespace when you want named output formats, headers, map rows, and column specs without writing layout strings directly. Drop down to clj-string-layout.core/layout when you need full DSL control.
High-level table API built on top of the layout DSL. Use this namespace when you want named output formats, headers, map rows, and column specs without writing layout strings directly. Drop down to clj-string-layout.core/layout when you need full DSL control.
(format-info format)Returns registry information for a named table format.
The returned map is descriptive and may contain implementation details such as :layout. It is useful for discovery, but callers should prefer table APIs over relying on this map's exact shape.
Returns registry information for a named table format. The returned map is descriptive and may contain implementation details such as :layout. It is useful for discovery, but callers should prefer table APIs over relying on this map's exact shape.
(formats)Returns the set of named formats accepted by table, table-str, and table-seq.
Returns the set of named formats accepted by table, table-str, and table-seq.
(table spec)Renders a high-level table spec to a vector of output lines.
Required input is usually :rows, with optional :headers, :footers, :columns, :title, :cell-fn, and :format. Supported formats are returned by formats. Column specs may contain :key, :title, :align, :format, :width, and :overflow. Overflow policies are :none, :clip, :ellipsis, :wrap, and :error. :footers accepts the same row shapes as :rows.
:cell-fn is an optional decoration callback that receives a context map with :section (one of :header, :data, :footer), :row (zero-based row index within the section), :col (column index), :column (the column spec), and :value (the post-format/escape cell value). It must return a string. Use it together with :display-width when adding ANSI styling so the layout engine pads with the original visible width.
When :title is supplied it renders as a centered banner above the table for text formats and as a <caption> element for :html. The title is escaped with the same per-format escaper unless :escape? false is set on the spec.
The :width and :display-width spec keys are forwarded to the layout engine for every format that emits visually padded text. They are intentionally ignored for :html output, where the result is structural markup rather than padded text. Pass :fill? true together with :width to make the generated formats expand toward that width. :raw? is honored for every format, including :html.
Renders a high-level table spec to a vector of output lines. Required input is usually :rows, with optional :headers, :footers, :columns, :title, :cell-fn, and :format. Supported formats are returned by formats. Column specs may contain :key, :title, :align, :format, :width, and :overflow. Overflow policies are :none, :clip, :ellipsis, :wrap, and :error. :footers accepts the same row shapes as :rows. :cell-fn is an optional decoration callback that receives a context map with :section (one of :header, :data, :footer), :row (zero-based row index within the section), :col (column index), :column (the column spec), and :value (the post-format/escape cell value). It must return a string. Use it together with :display-width when adding ANSI styling so the layout engine pads with the original visible width. When :title is supplied it renders as a centered banner above the table for text formats and as a <caption> element for :html. The title is escaped with the same per-format escaper unless :escape? false is set on the spec. The :width and :display-width spec keys are forwarded to the layout engine for every format that emits visually padded text. They are intentionally ignored for :html output, where the result is structural markup rather than padded text. Pass :fill? true together with :width to make the generated formats expand toward that width. :raw? is honored for every format, including :html.
(table-into! writer spec)Writes a rendered table to a java.io.Writer, one line per write.
Each line is followed by a single newline. Returns the writer. The table is rendered eagerly via table; pair with clj-string-layout.core/layout-into! for streaming behavior on the lower-level layout API.
Writes a rendered table to a java.io.Writer, one line per write. Each line is followed by a single newline. Returns the writer. The table is rendered eagerly via table; pair with clj-string-layout.core/layout-into! for streaming behavior on the lower-level layout API.
(table-seq spec)Renders a high-level table spec as a sequence of output lines.
This currently applies the high-level table normalization before returning the sequence. Use clj-string-layout.core/layout-seq directly when you need fully streaming behavior with already-normalized rows and explicit column widths.
Renders a high-level table spec as a sequence of output lines. This currently applies the high-level table normalization before returning the sequence. Use clj-string-layout.core/layout-seq directly when you need fully streaming behavior with already-normalized rows and explicit column widths.
(table-str spec)Renders a high-level table spec and joins the resulting lines with newlines.
Renders a high-level table spec and joins the resulting lines with newlines.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |