Skip to content

Relative links for non-JS browsers #228

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

Merged
merged 3 commits into from
Jun 18, 2017
Merged

Conversation

jmillikan
Copy link
Contributor

mdBook is a mostly pleasant experience in emacs' 'eww' browser (and probably other non-JS browsers). Next and prev links make it a bit more seemless.

Copy link
Member

@steveklabnik steveklabnik left a comment

Choose a reason for hiding this comment

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

thoughts?

@@ -20,6 +20,14 @@
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">

{{#previous}}
<link rel="prev" href="{{link}}#content">
Copy link
Member

Choose a reason for hiding this comment

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

{{/previous}}

{{#next}}
<link rel="next" href="{{link}}#content">
Copy link
Member

Choose a reason for hiding this comment

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

@jmillikan
Copy link
Contributor Author

Fair point. Here's a simplification. I added #content for convenience, but this doesn't seem to disturb chrome or firefox.

@steveklabnik
Copy link
Member

@azerupi what do you think?

{{/previous}}

{{#next}}
{{/next}}
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to do anything, is this a relic you forgot to remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, yes.

@@ -72,13 +78,13 @@

<!-- Mobile navigation buttons -->
{{#previous}}
<a href="{{link}}" class="mobile-nav-chapters previous">
<a rel="prev" href="{{link}}#content" class="mobile-nav-chapters previous">
Copy link
Contributor

Choose a reason for hiding this comment

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

What is #content supposed to do? When I test it locally it doesn't seem to change anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In 'eww', #content causes prev/next to jump past the TOC to the content. A "skip to content" link would probably be better for supporting screen readers etc, this is just what I'm using to generate books locally.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see, focusing on the content rather than the TOC has been requested in #235. But #content does not solve that issue, could you maybe try adding tabindex=1 to the content to see if it solves both issues at the same time? :)

@azerupi azerupi merged commit d24ad83 into rust-lang:master Jun 18, 2017
@azerupi
Copy link
Contributor

azerupi commented Jun 18, 2017

I merged this with a small modification, I left out the #content anchor links as I have recently merged another PR fixing that issue (with js) and I'm not sure if it would collide or not.

Thanks a lot for the PR and I'm terribly sorry for the delay. :)

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.

3 participants