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

Linked text rendered as unvisited links when appending command output to HTML file #9

Closed
dottspina opened this issue Dec 7, 2024 · 1 comment

Comments

@dottspina
Copy link
Owner

When appending a captured command output to an existing HTML file, we ask the rich library Console.export_html() API to generate inline CSS styles rather than:

  • CSS class definitions in a <style> element
  • which the <span>s making the actual output will later point to using class identifiers

This is handy: we don't have to deal with merging existing classes and new HTML elements, with overlapping identifiers.

Unfortunately, Web browsers will render the linked texts generated by the rich library (e.g. a compatible string linked to a YAML binding file) with their default style for unvisited links (typically blue), instead of the expected style (e.g. the one consistently used for compatible strings).
This results in ugly/confusing HTML files.

We submitted a patch to the upstream rich library project [1].

[1] Textualize/rich#3580

dottspina added a commit that referenced this issue Dec 9, 2024
When appending a captured command output to an existing HTML file,
we asked the rich library Console.export_html() API to generate
inline CSS styles rather than:
- CSS class definitions in a <style> element
- which the <span>s making the actual output will later point to
  using class identifiers

This was handy: we didn't have to deal with "merging" existing classes
and new HTML elements, both 1-indexed and overlapping.

Unfortunately, the HTML generated by the rich library
will render linked texts (e.g. a compatible string linked
to a YAML binding file) with the Web browser's default style
for unvisited links (typically blue),
instead of the expected style (e.g. the one consistently used
for compatible strings).
This can produce ugly/confusing outputs [1].

We submitted a patch to the upstream rich library project [2].

This commit relies on dtsh.rich.html to decouple DTSh command
output redirection to HTML files from the inline styles generated
by the rich library.
We may keep this approach even if the initial issue is fixed upstream.

[1] #9
[2] Textualize/rich#3580
@dottspina
Copy link
Owner Author

Closing this: DTSh does no longer rely on inline CSS styles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant