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
-
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.
![grafik](https://private-user-images.githubusercontent.com/56254406/321943119-2cc57e97-e3bf-4bce-899c-21dfb3d93dc8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTAzNTksIm5iZiI6MTczOTM1MDA1OSwicGF0aCI6Ii81NjI1NDQwNi8zMjE5NDMxMTktMmNjNTdlOTctZTNiZi00YmNlLTg5OWMtMjFkZmIzZDkzZGM4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDA4NDczOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU2ZTM4ZmIwMDUxNWY0ODMxMmYxMWM1MjUxZWYzZDdjNjQ3MTJkNmMxNmMzNjAzZjIxZGUwZDliNjQ2MWU4YzgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.c5Om7MGL4OKXMkbUQd6TTH_-6E04_CFjAckl5uMnu0A)
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