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

<497> Add anchors to main sections #613

Merged
merged 4 commits into from May 16, 2024
Merged

<497> Add anchors to main sections #613

merged 4 commits into from May 16, 2024

Conversation

federicobucchi
Copy link
Member

Motivation:

#497

Modifications:

  • assets/stylesheets/_screen.scss > added style to show # on h2 hover
  • assets/javascripts/application.js > adding anchors for each h2 with id in the seen page

Result:

Only targeting h2 with id for now.

Screenshot 2024-03-23 at 9 48 26 PM Screenshot 2024-03-23 at 9 49 00 PM

@federicobucchi
Copy link
Member Author

@swift-ci please test

@alexandersandberg
Copy link
Collaborator

I believe this is a duplicate of #517?

Copy link
Collaborator

@kaishin kaishin left a comment

Choose a reason for hiding this comment

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

I am inclined to vote for doing this using Jekyll if possible.

@federicobucchi
Copy link
Member Author

@kaishin @alexandersandberg updated

@daveverwer
Copy link
Collaborator

Great job getting this done with Jekyll 👍 That's a great solution.

My only comment is with the styling. It might look better if it extended to the left of the title to the left of the bounding box rather than being on the right? Also, I wonder if we should draw a little "chain links" icon which might make it more obvious than the hash character what's happening?

Also, whether we use an icon or a hash, we should give it a title of "Permalink" or something like that so that if people hover over it, it's more obvious what it does.

I can draw an icon if you would like to go this direction. I won't until we decide if we want to go that way, though!

@federicobucchi
Copy link
Member Author

@daveverwer I added the title and the chain link icon.

I didn't move it to the left because I found that (in my research) that most of the anchors were placed on the left of the heading.

Screenshot 2024-04-24 at 10 38 27 AM
Screenshot 2024-04-24 at 10 38 38 AM

@federicobucchi
Copy link
Member Author

@swift-ci please test

Copy link
Collaborator

@daveverwer daveverwer left a comment

Choose a reason for hiding this comment

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

Looks great!

Copy link
Collaborator

@kaishin kaishin left a comment

Choose a reason for hiding this comment

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

The site isn't building due to an unescaped character.

_plugins/convert-header.rb Outdated Show resolved Hide resolved
@kaishin
Copy link
Collaborator

kaishin commented May 7, 2024

@federicobucchi Beside the build issue above, the anchors are always visible on h4. They are also vertically misaligned and appear larger compared to the text.

We can perhaps use CSS to size the SVG using type-related units (em, rem) etc and if that doesn't work I wonder if we should revert to "#" as it would avoid this whole category of problems.

screenshot-2024-05-07

@federicobucchi
Copy link
Member Author

@swift-ci please test

@federicobucchi
Copy link
Member Author

@kaishin yeah that was a problem, but for now we want only h2 so we shouldn't have the vertical align issue

Screenshot 2024-05-07 at 10 52 50 AM Screenshot 2024-05-07 at 10 54 53 AM

@federicobucchi
Copy link
Member Author

@swift-ci please test

@alexandersandberg
Copy link
Collaborator

Not sure if I'm missing anything but I don't see any anchors anywhere when running locally. I'm on the latest commit.

@federicobucchi
Copy link
Member Author

@alexandersandberg I just tested, it works for me:

  • Going to the page: /getting-started/
  • Hover for example of "Using Swift"

@alexandersandberg
Copy link
Collaborator

alexandersandberg commented May 9, 2024

@alexandersandberg I just tested, it works for me:

  • Going to the page: /getting-started/
  • Hover for example of "Using Swift"

Ok, so it worked if I first did LC_ALL=en_us.UTF-8 bundle exec jekyll build and then ... serve. Probably due to some cache. As long as it works for people pulling the code for the first time it should be fine.

It does not appear white in dark mode for me though.

CleanShot 2024-05-09 at 08 16 43

@federicobucchi
Copy link
Member Author

@alexandersandberg I have no idea of what you are experiencing unfortunately.

I am running LC_ALL=en_us.UTF-8 bundle exec jekyll serve

I have tried with Auto or forcing Light and Dark themes and all works correctly for me:

Screenshot 2024-05-09 at 3 35 49 PM Screenshot 2024-05-09 at 3 35 42 PM

@alexandersandberg
Copy link
Collaborator

@alexandersandberg I have no idea of what you are experiencing unfortunately.

I am running LC_ALL=en_us.UTF-8 bundle exec jekyll serve

I have tried with Auto or forcing Light and Dark themes and all works correctly for me:

Screenshot 2024-05-09 at 3 35 49 PM Screenshot 2024-05-09 at 3 35 42 PM

It works for me in Firefox, but not Safari.

@federicobucchi
Copy link
Member Author

@alexandersandberg I have no idea of what you are experiencing unfortunately.
I am running LC_ALL=en_us.UTF-8 bundle exec jekyll serve
I have tried with Auto or forcing Light and Dark themes and all works correctly for me:
Screenshot 2024-05-09 at 3 35 49 PM Screenshot 2024-05-09 at 3 35 42 PM

It works for me in Firefox, but not Safari.

I tried with Safari, Firefox and Chrome. All works for me.

@kaishin when you have the chance can you please try too?

If I get another approval, I will merge and we can try if @alexandersandberg experiences the same in prod (there is no risk since, at worst, @alexandersandberg wouldn't see the change)

Copy link
Collaborator

@kaishin kaishin left a comment

Choose a reason for hiding this comment

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

Thanks for addressing all the issues @federicobucchi! It is working fine on my side, in Safari and other browsers, in both light and dark modes.

@federicobucchi federicobucchi merged commit b09842f into main May 16, 2024
@federicobucchi federicobucchi deleted the fb/add-anchors branch May 16, 2024 14:42
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

4 participants