Documentation
¶
Overview ¶
Package render produces multi-mimetype representations of golars values for Jupyter and other notebook frontends.
HTML mirrors the polars-py table style: a wrapped <table> with a shape caption, dtype subheader, and zebra rows. Markdown is GFM pipe-tables. Plain text reuses dataframe.DataFrame.Format() so it stays bit-identical to the REPL.
Use directly with gonb:
import "github.com/janpfeifer/gonb/gonbui" import jrender "github.com/Gaurav-Gosain/golars/jupyter/render" gonbui.DisplayHTML(jrender.HTML(df))
or via the bundled custom kernel (cmd/golars-kernel) which renders every materialised frame as text/plain + text/html automatically.
Index ¶
- func HTML(df *dataframe.DataFrame) string
- func HTMLWith(df *dataframe.DataFrame, lim Limits) string
- func Markdown(df *dataframe.DataFrame) string
- func MarkdownWith(df *dataframe.DataFrame, lim Limits) string
- func MimeBundle(df *dataframe.DataFrame) map[string]string
- func Text(df *dataframe.DataFrame) string
- type Limits
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTML ¶
HTML renders df as a self-contained HTML fragment. No external CSS dependency: all styling is inline so the table renders identically in JupyterLab, classic Notebook, nbviewer, and Quarto exports.
func HTMLWith ¶
HTMLWith is HTML with caller-supplied limits.
Styling: borders use currentColor at 25% opacity, headers use currentColor at 100%, dtypes + nulls at 60% / 40%. No filled backgrounds. This way the table inherits the surrounding text colour and reads on light or dark JupyterLab themes without hardcoding either palette.
func Markdown ¶
Markdown renders df as a GFM pipe-table. Useful when the consumer only renders markdown (e.g. some chat UIs) or when copy-pasting into a README.
func MarkdownWith ¶
MarkdownWith is Markdown with caller-supplied limits.
func MimeBundle ¶
MimeBundle returns the multi-mimetype dict Jupyter clients consume. Always includes text/plain; HTML and markdown go alongside so any frontend can pick its richest supported format.
Types ¶
type Limits ¶
Limits caps the rendered window so a 10M-row frame doesn't blow up the notebook. Defaults match dataframe.DefaultFormatOptions: head 5 + tail 5, max 8 columns. Set a field to -1 to disable that limit.
func DefaultLimits ¶
func DefaultLimits() Limits
DefaultLimits matches polars-py / dataframe.Format defaults.