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

Using <a> to support nested text-decoration #75

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

brettz9
Copy link
Contributor

@brettz9 brettz9 commented Apr 15, 2020

Builds on #57 .

I have switched here to using <a> instead of <span>.

The reason is that span will not allow overriding text-decoration styles (I had some underlining which wasn't getting disabled for this reason). (The same problem occurs in ansi-to-html's current state.)

I would have thought divs would work, but when using <div style="display: inline;">, though the Inspector (in Firefox or Chrome) shows the nested values as applying (e.g., a text-decoration: none), it still shows the content with an underline. This issue appears specific to text-decoration; the following can offer some more detail: https://stackoverflow.com/questions/1823341/how-do-i-get-this-css-text-decoration-override-to-work

But things work fine in both Firefox and Chrome when I change the elements to an <a> instead (without href). One problem is that the browser source shows this as invalid, I guess for having both flow and phrasing content, but I still think this may be the best solution.

You expressed concerns about this in #57 , but I think this is the only way to truly work with text-decoration overrides (as needed when overriding underline, strike-through, and overline). If you want this behind a flag, let me know.

(While I may be able to go back to using spans for the colors, I'm not sure if there are any cases where resetting a color should also reset the text-decoration. And I haven't added any tests for resetting command 0 to see its effect with text-decoration.)

Also uses `const` in README and fixes typo in sp. (of "usage") in CLI help
…k>` (`<blink>` assumes a CSS keyframes at-rule that cannot be defined inline, e.g.,: `@keyframes blink {50% {opacity: 0;}}`)

- Fix: Switch from `<span>` to `<a>` (without `href`); allows `text-decoration` to be overridden (without changing to a format-breaking `inline-block`); (div set to inline also does not work as `text-decoration` is a special case); the newly renamed tests, "disables underline"  and "rendering un-italic code appropriately", might not work as you wish, as they include an unnecessary disabling of underlining/italic tag, though perhaps if someone added that ANSI code, they actually wanted it (e.g., if assembling ansi together)
- Enhancement: Add rapid blink as distinct from slow blink
…ne (default) or bold-off

- Enhancement: Add alternativeFonts option
- Enhancement: Add fainter (2), Primary(default) font (10), 11-19 (alternative fonts), double-underline or bold-off (21),
Blink off (25), Reveal (28), Not crossed out (29), Not overlined (55)
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

Successfully merging this pull request may close these issues.

None yet

1 participant