merenlab / merenlab.org

Web content for Meren Lab
http://merenlab.org
MIT License
11 stars 31 forks source link

Toc fix #142

Closed matthewlawrenceklein closed 2 years ago

matthewlawrenceklein commented 2 years ago

this patch preserves the initial highlighting functionality of the table of contents. A new file, toc.js, has been directly injected into the _toc.html file in the includes directory, and the relevant code has been migrated over from the _main.js file. Some CSS has been rewritten to target the previous TOC implementation. toc_fix

meren commented 2 years ago

Hey @matthewlawrenceklein, this is great! Thank you. I can see that its working with the 2016/06/22/anvio-tutorial-v2/ as shown in your screen capture, but it is not working with tutorials/infant-gut/ or data/fmt-gut-colonization/.

Plus, I was wondering if we can center the highlighted cell in TOC vertically. When the TOC is too long, the highlight disappears as you scroll through the page (you can see it by making your browser's height tiny).

matthewlawrenceklein commented 2 years ago

@ekiefl are you able to chime in here? I recall you noticed some broken links in the infant gut tutorial, but I'm not totally sure what could be responsible for the breakage. My understanding is that the jekyll-toc script runs through each html page, rips out anything in an <h_> tag, and uses the h value to set/nest items in the toc display. Since our posts/tutorials start as markdown files and uniformly use the # syntax to denote headers, I'm not sure why the end result would differ from page to page.

@meren, as I navigate across the site, the toc patch appears to be working as intended for the majority of pages I visit, but definitely not all. I'll keep poking around!

ekiefl commented 2 years ago

I recall you noticed some broken links in the infant gut tutorial, but I'm not totally sure what could be responsible for the breakage.

You're right. I forget the exact details, but you can test if the links are working by clicking each one--if your scrollview doesn't update to that position, the hyperlink is broken/outdated. I assumed that was the cause, but it may not be. Another idea I have is to look at the md file for the infant gut. It may have some include statements about toc that override the changes you made.

meren commented 2 years ago

thank you, @matthewlawrenceklein! it is now in the main branch :)

ekiefl commented 2 years ago

Thank you @matthewlawrenceklein and @meren!