-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Improve dom_id
uniqueness in guides
#50988
Improve dom_id
uniqueness in guides
#50988
Conversation
80b96e5
to
1934554
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Does it make it more difficult to target those anchors in internal links within the guides (in case we want to point to them manually for instance -- not common but possible), because they'll get the node index now?
I mean, previously we could link by hand knowing they are prefixed by parent node, now it's index base so not as easy to do it.
Yes, I'll change it a bit. We can leave the parent node dom_id as those should be uniq anyway. |
99b9248
to
e59bc3c
Compare
@carlosantoniodasilva I've made the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks and works great, thanks for the fix! Just had one minor suggestion for consideration, not a blocker.
(test failure is unrelated)
All headers in a guide get a unique `dom_id` to make anchor links work. If a header is already present we would prefix it with the `dom_id` of the parent node. This would not work for headers without parent nodes. This commit simplifies the `dom_id` uniqueness by only prepending the parent node if it exists. This can still result in duplicates at the same level, but for these we already show a warning: *** DUPLICATE ID: 'some_id', please make sure that there are no headings with the same name at the same level. Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
955a275
to
a720480
Compare
Thanks @carlosantoniodasilva I've made the change. |
Perfect, thanks! |
All headers in a guide get a unique
dom_id
to make anchor links work.If a header is already present we would prefix it (and it's duplicate) with the
dom_id
of the parent node.This would raise an error for headers without parent nodes:
This commit simplifies the
dom_id
uniqueness by only prepending theparent node if it exists. This can still result in duplicates at the
same level, but for these we already show a warning:
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]