Pluto: highlighters in PrettyTables not working


I am using Pluto. I have a matrix, and I want to highlight some of its entries using highlighters in PrettyTables. I can get the matrix printed out in the REPL, but unfortunately, the highlighters seem to be not working inside Pluto. Some help would be very much appreciated.


pretty_table(randn(8,8), crop = :none, highlighters = (hl_lt(0.0), hl_gt(0.0)))

The output is this:

You can use @with_terminal from PlutoUI to see the terminal-printed table inside Pluto (including color highlights).
You can also do pretty_table(HTML,...) to render the table as HTML inside Pluto, but apparently highlighters are not supported for this HTML output.

1 Like

@yha, thank you very much. It does work inside Pluto, using

with_terminal() do
	pretty_table(randn(8,8), crop = :none, formatters = ft_printf("%5.3f"), highlighters = (hl_lt(0.0), hl_gt(0.0)))

Sorry! I completely missed this post. You can use highlighters for HTML backend, but not those created for the text backend. In this case, you must pass the HTML decoration you want. For example:

pretty_table(HTML, rand(8, 8); highlighters = hl_lt(0.5, HTMLDecoration(color = "red")))

@Ronis_BR, that will solve the problem, without having to resort to the terminal. Thanks a lot.

1 Like