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

a.tag-link renders poorly in tables #1332

Open
MasssiveJuice08 opened this issue Aug 10, 2024 · 1 comment
Open

a.tag-link renders poorly in tables #1332

MasssiveJuice08 opened this issue Aug 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@MasssiveJuice08
Copy link
Sponsor Contributor

MasssiveJuice08 commented Aug 10, 2024

Describe the bug

Tags in tables render poorly:

  1. With large tables, they get broken up so they become difficult to read
  2. The padding (and by extension the background-color) gets pushed onto a new line

Screenshot 2024-08-10 192501

Issue 1

This can be fixed by changing overflow-wrap to "normal" and hyphens to "none" for a.tag-link.internal.alias inside td.

  • Overflow-wrap: Having this set to "anywhere" breaks up the tags excessively. As a contiguous element with a highlighted background, they look best on a single line, or only breaking onto a new line if the tag contains a hyphen already (e.g., #cool-tag)
  • Hyphens: Tags often contain hyphens when stringing together multiple words in a tag, so setting hyphens to auto is unnecessary and over-hyphenates them

Issue 2

A problem persists when altering the overflow-wrap and hyphens to the above settings: the background-color of a tag element can break onto a new line even when the text itself does not:

Screenshot 2024-08-10 200026

I have been unable to find a fix for this. It appears tied to the padding of a and a.tag-link elements (0 0.1rem and 0.2rem 0.4rem respectively). Removing this padding prevents the background-color breaking onto a new-line, but it also negatively impacts the visual style of the tag links.

The only fix I have found is to set whitespace to either "nowrap" or "pre". However, this prevents the tags from breaking onto a new line where appropriate, such as if the tag name contains a hyphen already (e.g., #cool-tag)

To Reproduce

Steps to reproduce the behavior:

  1. Create a large table with many columns: 6-8 or more is appropriate
  2. fill it with dummy tags of varying lengths and formats (some with hyphens and some without)

Expected behavior:

Tag background color extending past the end of the text to the right should not break onto a new line in a table cell unless there is text contained within the background color on the new line

Screenshots and Source

See above

You can help speed up fixing the problem by either

  1. providing a simple reproduction
  2. linking to your Quartz repository where the problem can be observed

Desktop (please complete the following information):

  • Quartz Version: 4.3.0
  • node Version: 20.11.1
  • npm version: 10.2.4
  • OS: Windows 11
  • Browser: chrome

Additional context

Refer to how multi-column tables (containing only tags) render in Obsidian. The same table rendered in Obsidian as the one in Quartz from the screenshots above:

Screenshot 2024-08-10 192539

@MasssiveJuice08 MasssiveJuice08 added the bug Something isn't working label Aug 10, 2024
@MasssiveJuice08
Copy link
Sponsor Contributor Author

Hey @jackyzha0 a 'fix' for this is possible by setting whitespace to 'nowrap' for a.tag-link.internal.alias when it is a child of <td>, but it's a subjective one as it would mean tags in tables never wrap onto a new line.

Would you consider implementing 'nowrap' as fix?

It could have the unintended consequence of making some table columns disproportionately wider than they need to be because of a single long tag.

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

1 participant