Is it possible to generate html without printing to console #1183
-
First of all awesome tool !! :) I am wondering whether it is possible to export to html without having to dump to the console at the same time. The documentation states that I have to set Is there a way to achieve this behavior, which I have overlooked? Thanks ! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Something along these lines should work: console = Console(record=True)
with console.capture():
console.print("[b]Hello")
console.save_html("hello.html") However, the most flexible way to create a console that exports HTML but never writes to the console would be to construct the Console with a file that goes nowhere. Something like this: import os
console = Console(record=True, file=open(os.devnull, "wt"), color_system="truecolor", width=100) |
Beta Was this translation helpful? Give feedback.
Something along these lines should work:
However, the most flexible way to create a console that exports HTML but never writes to the console would be to construct the Console with a file that goes nowhere. Something like this: