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

feat(docs): add anchor links on description terms #8413

Merged
merged 6 commits into from
Oct 11, 2023

Conversation

KartikSoneji
Copy link
Contributor

Summary

Fixes: #8394

Problem

There is no easy way to link to an element of a description list

Solution

Automatically add <a> tags with href pointing to the <dt>'s id


Screenshots

(on hover)

Before

image

After

image

@github-actions github-actions bot added macros tracking issues related to kumascript macros markdown markdown related issues and pull requests labels Mar 14, 2023
@KartikSoneji KartikSoneji force-pushed the feature/hyperlink-dt-table-entries branch 3 times, most recently from a605a6a to 1e9cf4a Compare March 14, 2023 06:17
@github-actions github-actions bot added dependencies Pull requests that update a dependency file merge conflicts 🚧 Please rebase onto or merge the latest main. labels Mar 14, 2023
@github-actions
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@KartikSoneji KartikSoneji force-pushed the feature/hyperlink-dt-table-entries branch from 1e9cf4a to 28a7286 Compare March 14, 2023 06:19
@github-actions github-actions bot removed merge conflicts 🚧 Please rebase onto or merge the latest main. dependencies Pull requests that update a dependency file labels Mar 14, 2023
@KartikSoneji KartikSoneji force-pushed the feature/hyperlink-dt-table-entries branch 2 times, most recently from c61ef3c to 22310b3 Compare March 21, 2023 17:32
@KartikSoneji KartikSoneji force-pushed the feature/hyperlink-dt-table-entries branch 2 times, most recently from 0f99668 to 5212f24 Compare March 21, 2023 17:36
@dipikabh
Copy link
Contributor

dipikabh commented Jun 15, 2023

How about:

  • We drop the underline (we don't want to give the impression that clicking will take reader to another page)
  • The "#" or 🔗 icon can always be present next to the dt id (not just on hover)

Update: reverting these suggestions because the PR is inline with the current design on the website

@KartikSoneji
Copy link
Contributor Author

KartikSoneji commented Jun 15, 2023

Hmm. I replicated the behaviour of the headings to remain consistent with the design language.

image

@dipikabh
Copy link
Contributor

I replicated the behaviour of the headings

Yup, I noticed that and came back here to take back my comment/suggestion 🙂

@KartikSoneji
Copy link
Contributor Author

@dipikabh while I have your attention, can you please go through KartikSoneji:feature/add-css-animations?
I added some animations to the # and a simple fade to the underline since they look a bit jarring at the moment.

@SphinxKnight
Copy link
Member

cc @mdn/mdn-community-engagement since this one is aging.

@caugner caugner changed the title feat: Generate Clickable Links for Description Lists feat(docs): generate Clickable Links for Description Lists Jul 18, 2023
@caugner caugner changed the title feat(docs): generate Clickable Links for Description Lists enhance(docs): generate clickable links for description lists Jul 19, 2023
@KartikSoneji
Copy link
Contributor Author

Hi, just a gentle reminder about this :)

@caugner caugner self-requested a review September 25, 2023 15:41
@caugner caugner self-assigned this Sep 25, 2023
@caugner caugner changed the title enhance(docs): generate clickable links for description lists feat(docs): add anchor links on description terms Oct 11, 2023
@caugner caugner merged commit ff73a32 into mdn:main Oct 11, 2023
@caugner
Copy link
Contributor

caugner commented Oct 11, 2023

Thank you @KartikSoneji, and sorry for the long review time! 🙏

@OnkarRuikar
Copy link
Contributor

Now there is no way to recognize actual links:
https://developer.mozilla.org/en-US/docs/Web/CSS/border#values
vs old implementation:
https://web.archive.org/web/20231011150428/https://developer.mozilla.org/en-US/docs/Web/CSS/border#values

For <line-style> and <color> list items now there is no indication that these are hyper links.

@caugner
Copy link
Contributor

caugner commented Oct 13, 2023

@OnkarRuikar Good catch, can you open an issue for that?

@OnkarRuikar
Copy link
Contributor

@OnkarRuikar Good catch, can you open an issue for that?

Done #9810

caugner added a commit that referenced this pull request Oct 13, 2023
#8413 introduced a regression, making it 
hard to identify description terms (`<dt>`) that link to another page.

This restores the style of those links, excluding anchor links, and
also makes the hashtag of the anchor links interactive.

Co-authored-by: Onkar Ruikar <[email protected]>
Comment on lines +48 to +51
if (firstDtChild) {
dtChildren.unshift(
h(node, "a", { "data-link-to-id": "true" }, [firstDtChild])
);
Copy link
Collaborator

@wbamberg wbamberg Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is ideal that this modifies the Markdown engine. It would be better if the Markdown just produced a clean <dl>, and this extra feature were implemented on top of the HTML output.

(basically, when we are talking about "MDN markdown", the fewer additions to GFM we have to talk about, the better.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is ideal that this modifies the Markdown engine. It would be better if the Markdown just produced a clean <dl>, and this extra feature were implemented on top of the HTML output.

I don't disagree. @wbamberg Do you mind opening an issue for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, I'll look into it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @KartikSoneji . I didn't say, but should have, that this is a really nice feature, and thank you for adding it :).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
Not sure if you remember but you reviewed it the first time around too: #3428

@KartikSoneji KartikSoneji deleted the feature/hyperlink-dt-table-entries branch October 13, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macros tracking issues related to kumascript macros markdown markdown related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Regression?] Generate clickable tags for description terms
6 participants