Replies: 1 comment
-
I like to add that I want to serve the content in a company internal network, only. I don't want to publish it in the internet. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to save some rich console output to html using
console.save_html
.Loading the generated html file using a browser (e.g. Mozilla) I can see it renders correctly.

The generated html (anonymized) looks like this:
However, I would like to regularly update the console and export the updated content again and again.
Then I would like to make the export accessible via
http.server
and embed it into a context which contains the<meta http-equiv="refresh" content="3">
tag.In order to be able to embed the generated html into another html page, I updated my export statement into
console.save_html("console_as_html.html", theme=rich.terminal_theme.SVG_EXPORT_THEME, inline_styles=True, code_format="<pre>{code}</pre>")
The exported html then looks the same as above but with headers removed:
The server code is this:
And this is how the served page looks with the embedded content:
Do you have some suggestion howto use the console export from
rich
withhttp.server
and embed it into another html?At first, I also tried using
console.save_svg
, which leads to the same issue.The
svg
can be loaded directly into the browser withfile->open
, but i cannot serve it usinghttp.server
.At second, I tried to specify an absolute path to the served object:
<embed type="text/html" src="absolute_path/console_as_html.html">
and I also tried to specify the protocol:<embed type="text/html" src="file:///absolutepath/console_as_html.html">
.Neither worked.
I hope to find some help here.
Think, this could be a pretty common use-case of the
console.save_html
method.Beta Was this translation helpful? Give feedback.
All reactions