0

I was wondering if there's a way to generate a separate table of content base on the main content?

I tried a few different things but did not seem to worked well, cause i am trying to get this working on GitHub Enterprise 2.8 Pages.

I tried jekyll-toc (https://github.com/toshimaru/jekyll-toc), and used it as a plugin, it worked in development, but doesn't work on GHE 2.8.

kramdown have its own ToC generation, but I don't think you can filter it the same way you can with jekyll-toc. Meaning I can't have it outside of the markdown page.

Or if there's other suggestion I can use?

Example:

Kramdown This is only can be in the markdown I believe

*ToC
{:toc}

jekyll-toc Applying to _layout

<div class="col-md-9" role="main">
    <h1>{{ page.title }}</h1>
    {{ content }}
</div>
<div class="col-md-3" role="complementary">
    {{ content | toc_only }}
</div>
YTKColumba
  • 25
  • 1
  • 8
  • Can you explain : "generate a separate table of content base on the main content" ? – David Jacquel Mar 04 '17 at 23:10
  • one example is given in jekyll-toc where it takes the main content and pass it through a filter and returns only the auto generate ToC, and this can be use within _layouts – YTKColumba Mar 05 '17 at 07:07
  • Possible duplicate of [Is it possible to generate a table of contents using kramdown in a page other than a post? If so, how?](https://stackoverflow.com/questions/25336661/is-it-possible-to-generate-a-table-of-contents-using-kramdown-in-a-page-other-th) See my answer: https://stackoverflow.com/a/45984607/1239484 – allejo Aug 31 '17 at 15:04

0 Answers0