W3cubDocs

/Nushell

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, ...)
  • --list, -l: produce a color table of all available themes

Input/output types:

input output
any string

Examples

Outputs an HTML string representing the contents of this table

> [[foobar]; [12]] |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>

Optionally, only output the html for the content itself

> [[foobar]; [12]] |to html--partial
<divstyle="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

> [[foobar]; [12]] |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.

Tips: Command to html was not included in the official binaries by default, you have to build it with --features=extra flag

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/to_html.html