to html for formats
Convert table into simple HTML.
Signature
> to html {flags}
Flags
-
--html-color, -c: Change ansi colors to html colors. -
--no-color, -n: Remove all ansi colors in output. -
--dark, -d: Indicate your background color is a darker color. -
--partial, -p: Only output the html for the content itself. -
--theme, -t {string}: The name of the theme to use (github, blulocolight, ...); case-insensitive. -
--list, -l: Produce a color table of all available themes. -
--raw, -r: Do not escape html tags.
Input/output types:
| input | output |
|---|---|
| nothing | any |
| any | string |
Examples
Outputs an HTML string representing the contents of this table
> [[foo bar]; [1 2]] | to html
<html><style>body { background-color:white;color:black; }</style><body><table><thead><tr><th>foo</th><th>bar</th></tr></thead><tbody><tr><td>1</td><td>2</td></tr></tbody></table></body></html>Outputs an HTML string using a record of xml data
> {tag: a attributes: { style: "color: red" } content: ["hello!"] } | to xml | to html --raw
<html><style>body { background-color:white;color:black; }</style><body><a style="color: red">hello!</a></body></html>Optionally, only output the html for the content itself
> [[foo bar]; [1 2]] | to html --partial <div style="background-color:white;color:black;"><table><thead><tr><th>foo</th><th>bar</th></tr></thead><tbody><tr><td>1</td><td>2</td></tr></tbody></table></div>
Optionally, output the string with a dark background
> [[foo bar]; [1 2]] | to html --dark
<html><style>body { background-color:black;color:white; }</style><body><table><thead><tr><th>foo</th><th>bar</th></tr></thead><tbody><tr><td>1</td><td>2</td></tr></tbody></table></body></html>Notes
Screenshots of the themes can be browsed here: https://github.com/mbadolato/iTerm2-Color-Schemes.
Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/to_html.html