Friday, 15 January 2010

how to write a table of contents with jekyll and redcarpet -



how to write a table of contents with jekyll and redcarpet -

using jekyll 2.0.3, configured _config.yml with

markdown: kramdown

and able add together table of contents follows, in example.md:

--- layout: page title: sample --- {:toc} ## section 1 ## section 2

however, switched redcarpet, see _config.yml:

markdown: redcarpet redcarpet: extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink", "strikethrough", "superscript", "with_toc_data"]

and {:toc:} not work.

the documentation of redcarpet v2.2.2 (used jekyll 2.0.3): https://github.com/vmg/redcarpet/blob/v2.2.2/readme.markdown#and-its-like-really-simple-to-use

mentions :with_toc_data, don't where/how utilize this.

how can display table of contents using redcarpet?

the problem here :with_toc_data alternative instance of redcarpet renderer, , not configuration extension.

unfortunately, jekyll doesn't seem expose renderer option, don't think you'll able utilize it. the docs say:

no renderer options aside smart can specified in jekyll.

but can utilize table of contents jekyll plugin instead. quick search returns number of available options, , one linked official jekyll site.

jekyll jekyll-extensions

No comments:

Post a Comment