Table of contents using Jekyll and Kramdown

Devin

I'm trying to use Kramdown's auto "Table of Contents" generator on a page (not a post) on my Jekyll site.

_includes/toc.html

<nav>
  <h4>Table of Contents</h4>
  {:toc}
</nav>

my_cool_stuff/my_cool_page.md

---
layout: page
---

{% include toc.html %}

# The title of my page
## The Subtitle of my page

The HTML is generated literally and I'm not getting a list of headers.

<nav>
  <h4 class="toc_title">On This Page</h4>
  {:toc}
</nav>

What am I setting up wrong?

David Jacquel

{:toc} is kramdown tag for automatic Table of content generation.

In your case, you need two more things to make it work :

  1. Allow kramdown to parse inside html blocks : in _config.yml add :

    kramdown:
      parse_block_html: true
    
  2. in _includes/toc.html, you need to provide a seed list :

    <nav>
      <h4>Table of Contents</h4>
      * this unordered seed list will be replaced by toc as unordered list
      {:toc}
    </nav>
    

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Jekyll: Place the kramdown table of contents in an _include for hash navigation

From Dev

Jekyll & KramDown - How to Display Table Border

From Dev

Jekyll: How to get markdown parsing inside blocks using Kramdown?

From Dev

Prevent line-wraps of code blocks using jekyll, kramdown, and rouge

From Dev

Jekyll produces different output than using kramdown directly

From Dev

Jekyll Kramdown Footnotes Not Parsing

From Dev

how to write a table of contents with jekyll and redcarpet

From Dev

how to write a table of contents with jekyll and redcarpet

From Dev

Fenced code blocks in Jekyll with kramdown?

From Dev

Jekyll kramdown how to center text

From Dev

Markdown Table not working (kramdown)

From Dev

Jekyll Kramdown code in ordered list - number reset

From Dev

Using jsoup to get contents of a table

From Dev

Make kramdown's ALDs available on entire Jekyll site

From Dev

How can I change the format of footnotes in Jekyll's kramdown?

From Dev

Shouldn't kramdown rouge generate syntax highlight classes with jekyll?

From Dev

Shouldn't kramdown rouge generate syntax highlight classes with jekyll?

From Dev

Using CSV file in PHP for updating contents of table

From Dev

How to export table contents to csv using java?

From Dev

How to make a table of contents using pdfmake?

From Dev

How to export table contents to csv using java?

From Dev

Get select table contents using Greasemonkey

From Dev

Update contents of a table, using php rand()

From Dev

Parsing text from a table of contents using regex

From Dev

Include table of contents in table of contents

From Dev

How to add class to kramdown-generated table of content?

From Dev

Print page numbers for table of contents using CSS in Chrome

From Dev

How to display the contents of a single row in a table using mysql command line?

From Dev

Display contents of a string in html table using preg_match and regex

Related Related

  1. 1

    Jekyll: Place the kramdown table of contents in an _include for hash navigation

  2. 2

    Jekyll & KramDown - How to Display Table Border

  3. 3

    Jekyll: How to get markdown parsing inside blocks using Kramdown?

  4. 4

    Prevent line-wraps of code blocks using jekyll, kramdown, and rouge

  5. 5

    Jekyll produces different output than using kramdown directly

  6. 6

    Jekyll Kramdown Footnotes Not Parsing

  7. 7

    how to write a table of contents with jekyll and redcarpet

  8. 8

    how to write a table of contents with jekyll and redcarpet

  9. 9

    Fenced code blocks in Jekyll with kramdown?

  10. 10

    Jekyll kramdown how to center text

  11. 11

    Markdown Table not working (kramdown)

  12. 12

    Jekyll Kramdown code in ordered list - number reset

  13. 13

    Using jsoup to get contents of a table

  14. 14

    Make kramdown's ALDs available on entire Jekyll site

  15. 15

    How can I change the format of footnotes in Jekyll's kramdown?

  16. 16

    Shouldn't kramdown rouge generate syntax highlight classes with jekyll?

  17. 17

    Shouldn't kramdown rouge generate syntax highlight classes with jekyll?

  18. 18

    Using CSV file in PHP for updating contents of table

  19. 19

    How to export table contents to csv using java?

  20. 20

    How to make a table of contents using pdfmake?

  21. 21

    How to export table contents to csv using java?

  22. 22

    Get select table contents using Greasemonkey

  23. 23

    Update contents of a table, using php rand()

  24. 24

    Parsing text from a table of contents using regex

  25. 25

    Include table of contents in table of contents

  26. 26

    How to add class to kramdown-generated table of content?

  27. 27

    Print page numbers for table of contents using CSS in Chrome

  28. 28

    How to display the contents of a single row in a table using mysql command line?

  29. 29

    Display contents of a string in html table using preg_match and regex

HotTag

Archive