If I have a page/post in Jekyll with headers, is it possible to auto-generate a table-of-contents/outline for navigation? Something akin to the top matter of a Wikipedia article.
相关问题
- Markdown to clipboard as rich text
- Jekyll Error “Liquid Exception: undefined method `
- Fixing Markdown styling in Notepad++
- How to use Markdown for textarea input field in La
- PHP Replace, But Alternate Replace String
相关文章
- >>" markdown 引用语法" href="https://www.manongdao.com/article-2318498.html" > 有没有办法让 markdown-it 支持 ">>>" markdown 引用语法
- Is there a Github markdown language identifier for
- “no implicit conversion of Integer into String” er
- Check if variable is type of string or array in li
- markdown自动代码缩进8格?
- Can you import/reference info from text files into
- 请问如何使用 C# 或是 regex 抓取出 markdown 内的图片链接呢 ?
- How do you center text in Gitlab markdown?
I have TOC for Jekyll blog which looks similar to Wikipedia TOC
So all my Jekyll posts have a Table of Contents section. It can be done just using kramdown.
Use this code inside your post where you want the TOC to appear
And use this CSS to style it like Wikipedia TOC
Use appropriate colors that suit your blog.
That is it!
TOC can also be done with the help of jekyll-table-of-contents, if in any case the above method doesn't work. This one uses Jquery and a js file.
Here is the detailed guide on how I did it: Jekyll TOC
https://github.com/allejo/jekyll-toc provides very easy way to add TOC to your jekyll page.
I'm assuming you mean a list of all H1, H2 elements etc in the content itself? I don't think Jekyll has anything built-in to handle that. I suspect the easiest way is to let Javascript generate it for you once the page has rendered, using something like this jQuery plugin, or one of the many other plugins/snippets available.
That is the markup parser's task.
In case of Markdown one of the syntax extensions defines Automatic generation of the table of contents:
This works in Maruku and kramdown.
you can use this code before your contents.