Skip to content

spec: generated TOC, with linkable headers and return to top links #3996

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
Sep 29, 2014

Conversation

gourlaysama
Copy link
Contributor

This adds a table of contents to the spec, with a way to get the link of a
header on hover (like on GitHub) and a "return to top" small icon at the
end of each section.

Jekyll generates the H1-level table of contents, and then the current
one is expended using jQuery all the way down to H5 titles. Examples and
H6 headers are ignored.

GitHub's (MIT licensed) octicons are used for nice "link" and "up"
icons.


Online preview here. It looks fine in Firefox (32) and Chrome (37) (and even, surprisingly, in IE8).

I just realized there is no particular reason for the TOC being on the right. I guess I was in a right-hand-side mood. I can move it to the left if needed...

review @retronym @som-snytt /cc @soc

This adds a table of contents to the spec, with a way to get the link of a
header on hover (like on GitHub) and a "return to top" small icon at the
end of each section.

Jekyll generates the H1-level table of contents, and then the current
one is expended using jQuery all the way down to H5 titles. Examples and
H6 headers are ignored.

GitHub's (MIT licensed) octicons are used for nice "link" and "up"
icons.
@scala-jenkins scala-jenkins added this to the 2.11.3 milestone Sep 22, 2014
@som-snytt
Copy link
Contributor

That's quite an advance for civilization, Herr Gutenberg.

@retronym
Copy link
Member

LGTM

Brilliant!

I also tested on Chrome on iPhone, the right-hand-side sidebar is unobtrusive there.

Next on my wish list:

  • If you land in a chapter, we should let you what document you are reading, and offer a navigation to the full index
  • Add the detailed TOC (maybe expandable/contractable) to the full index.
  • A Scala logo somewhere 😄
  • A print layout that doesn't include the side bar.

@soc
Copy link
Contributor

soc commented Sep 23, 2014

Well, what am I supposed to say? Must be a tradition that everything already done gets redone multiple times.

(Edit: No snark, just sadness.)

@gourlaysama
Copy link
Contributor Author

@soc oh, I feel like an idiot now, I hadn't realized that you had done that already.

When I opened your version of the spec, there was no TOC at all. Going back to it, I just realized it didn't show up because my screen isn't wide enough: below ~1390px-wide there is only the content. That what I get for using a lateral tab bar...

@soc
Copy link
Contributor

soc commented Sep 23, 2014

@gourlaysama Hey, no problem. I lament the process which enables this, not persons.

@gourlaysama
Copy link
Contributor Author

@retronym I pushed two new commits:

  • A Scala logo somewhere 😄

I added a banner on top with the logo (from the many logos available in the scala-lang repo). Ideas welcome :)

  • A print layout that doesn't include the side bar.

Fixed

  • If you land in a chapter, we should let you what document you are reading, and offer a navigation to the full index

You mean a "Scala Language Specification" header on top, or something more? Maybe showing a "Index" entry in the TOC?

@retronym
Copy link
Member

LGTM. I'm going to merge this but I'd encourage other speciphiles to take a look over the finished article in search of any problems with the sidebar layout.

retronym added a commit that referenced this pull request Sep 29, 2014
spec: generated TOC, with linkable headers and return to top links
@retronym retronym merged commit 2cfac1a into scala:2.11.x Sep 29, 2014
@gourlaysama gourlaysama deleted the wip/spec branch October 12, 2014 12:37
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.

5 participants