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

Add anchor links to all headers #28641

Merged
merged 1 commit into from Apr 2, 2017
Merged

Add anchor links to all headers #28641

merged 1 commit into from Apr 2, 2017

Conversation

diazruy
Copy link
Contributor

@diazruy diazruy commented Apr 2, 2017

To allow easy linking at all levels and not just from index

Summary

Updated the markdown renderer for the guides to wrap all headers (h3-h6) in an anchor tag to allow easy linking within the guide and not just from the sidebar index.

Other Information

Updated the main.css as to maintain existing look and feel, making the headings only underline when hovered on.

To allow easy linking at all levels and not just from index
@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@matthewd
Copy link
Member

matthewd commented Apr 2, 2017

Thanks! Even the ones in the ToC can be annoying to get a link for; I think this is a great improvement.

@matthewd matthewd merged commit 2458e07 into rails:master Apr 2, 2017
@claudiob
Copy link
Member

claudiob commented Apr 4, 2017

This is how the guides look after this PR:

screen shot 2017-04-04 at 9 07 02 am

I am a little confused by seeing all those links which simply link to themselves.

@diazruy @matthewd was that the intended outcome?

The links from the sidebar were already working since the anchor was already matched by the ID attribute of the surrounding header, as in:

<h3 id="templates-partials-and-layouts">
  <a class="anchorlink" href="#templates-partials-and-layouts">3 Templates, Partials and Layouts</a>
</h3>

@matthewd
Copy link
Member

matthewd commented Apr 4, 2017

Yes -- for the same reason this GitHub page contains a bunch of links that link to themselves.

@diazruy
Copy link
Contributor Author

diazruy commented Apr 4, 2017

@claudiob now you can right click on any header in the docs, copy the link and paste it for someone else to go directly to a particular section in the documentation. The sidebar links only include 2 levels, so you can't go to a more granular level. Also, if you're already reading a particular section and you want to link to it, you would have to scroll to the top, find the link in the sidebar and then copy it.

@claudiob
Copy link
Member

claudiob commented Apr 4, 2017

How do you feel about adding color: #333 to #mainCol a.anchorlink?

Then the headers would still be links, and would still get underlined on hover, but the actual links would become more prominent:

links

@matthewd
Copy link
Member

matthewd commented Apr 4, 2017

👍🏻

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

5 participants