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

fix: ensure HTML ID attributes are unique #607

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

Conversation

BenGale93
Copy link

Summary

Previously, if you had multiple GT HTML tables inside a single document, that had column names in common, you would have repeated HTML ID attributes. This PR makes these ID attributes unique by prepending the table ID, if it exists.

Related GitHub Issues and PRs

Checklist

Copy link

codecov bot commented Feb 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.72%. Comparing base (3d6ad09) to head (6635b4b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #607   +/-   ##
=======================================
  Coverage   90.71%   90.72%           
=======================================
  Files          46       46           
  Lines        5417     5422    +5     
=======================================
+ Hits         4914     4919    +5     
  Misses        503      503           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rich-iannone
Copy link
Member

This looks great, thanks! However, it looks like the formatting used for the new ID values shouldn't have a space. According to a W3Schools page:

The id name must contain at least one character, cannot start with a number, and must not contain whitespaces (spaces, tabs, etc.).

Could you revise to use a hyphen instead?

@BenGale93
Copy link
Author

Just updated it. I also applied the same rule to the column label and updated the test to have a column with a space in the name to demonstrate that.

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.

2 participants