Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Links in terminal maintain color, but not if we export to HTML #1009

Closed
koaning opened this issue Feb 14, 2021 · 4 comments
Closed

[BUG] Links in terminal maintain color, but not if we export to HTML #1009

koaning opened this issue Feb 14, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@koaning
Copy link

koaning commented Feb 14, 2021

I'm working on a little cron-dashboard. This is what it looks like; from the terminal.

image

The idea is that my app will keep track of where all the logs are and that you can easily find the logs of the jobs that failed. But I don't just want to have users find logs in the terminal. I also want to export these to HTML. So I was super stoked when I learned rich basically just supports this.

I've printed the table via a Console which I've set to record and I've taken the liberty to also export it to HTML. This is where there is a subtle bug. Notice the subtle difference in the link-line under the red x.

image

I might imagine that we'd like to keep the colors consistent here. The link in the browser should carry the color of the parent. I think this is a bug, but if this is by design I'll gladly hear it.

Code

This is the code that is used inside the table.

f"[red][link={make_link()}.html]x[/link][/red]"
@willmcgugan
Copy link
Collaborator

willmcgugan commented Feb 14, 2021

Hi Vincent,

I think that's due to the order of the <a> and <span> tags. It's probably generating <span><a>X</a></span> So the link style is taking preference. It should probably be <a><span>X</span></a> .

I'll have a look a that shortly. Unless you want to tackle that yourself? It should be an easy fix in export_html.

@willmcgugan willmcgugan added bug Something isn't working and removed Needs triage labels Feb 14, 2021
@koaning
Copy link
Author

koaning commented Feb 14, 2021

I've had a quick look but the code-base looked a tad bit too much to take in all in one go. I might try again later, but don't let me hold you!

@willmcgugan
Copy link
Collaborator

Got a fix. Will be in the next version.

@willmcgugan
Copy link
Collaborator

Please try 9.11.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants