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

table parser add data attributes for easier styling #8175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pmario
Copy link
Contributor

@pmario pmario commented May 3, 2024

Main Goal TLDR;

Having the data-addr attribute on every cell, it will allow custom js-macros to create very specific STYLEs to make it easy for users to manually style single cells eg: <<tableBG green>>, without the need to count rows or columns, which is needed at the moment.


This PR adds some new attributes to tables created with wikitext. This makes it easier to style columns and specific cells.

  • oddCol or evenCol classes are added to every table-cell.
    • colCount starts with 1
  • data-row attribute is added to every TR element
    • rowCount starts with 0 for compatibility reasons and
    • TH element usually is row 0
  • data-col attribute is added to every cell
  • data-addr attribute added to every cell. The format is <rowCount>/<colCount>

This allows us to:

  • Style a alternating columns based on CSS .oddCol and .evenCol
  • Style a specific column based on CSS [data-col="x"] selector
  • Style a specific row based on CSS [data-row="y"] selector
  • Style a specific cell with CSS [data-addr="row/col"]

Related Talk threads:

Copy link

vercel bot commented May 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
tiddlywiki5 ✅ Ready (Inspect) Visit Preview May 3, 2024 1:07pm

@pmario
Copy link
Contributor Author

pmario commented May 3, 2024

The best way to test is

| A | B | C | D |h
|Cell1 |Cell2 |Cell3 |Cell4 |
|Cell5 |Cell6 |Cell7 |<|
|Cell5 |~|Cell7 |Cell8 |
|>|Cell9 |Cell10 |Cell11 |

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