Redcarpet & Middleman: :with_toc_data
-
08-06-2021 - |
Question
I'm wondering about using Redcarpet's :with_toc_data option for Markdown working with Middleman (a Sinatra-based static site generator).
Our current config.rb:
set :markdown, :layout_engine => :haml
set :markdown_engine, :redcarpet
This doesn't work:
set :markdown, :layout_engine => :haml, :with_toc_data => true
set :markdown_engine, :redcarpet
Any help is very appreciated!
Solution
Fixed in Middleman 3.0 by Thomas Reynolds: https://github.com/middleman/middleman/issues/442
OTHER TIPS
It appears that from Issue #200 of Middleman at Github, this should be done as such:
set :markdown, :layout_engine => :haml
set :markdown_engine, :redcarpet
set :redcarpet, :with_toc_data => true
The third line being the key. I also can't make this work, so there might be something still open as a bug with Middleman?
The latest release is 2.0.15.3
, which is what I have installed; but I also can't make it work. Perhaps Issue #200 should be re-opened?
I have this exact code in my config.rb
:
###
# GitHib flavoured Markdown, I can't go back!
###
set :markdown_engine, :redcarpet
set :redcarpet, fenced_code_blocks: true, autolink: true
I'd be eager to understand if I am doing something incorrectly. (I'm specifically trying to use this in a Middleman Blog)
Update to my answer: The commit referenced in Issue #200 does not exist in the 2.0.15.3
release, thus we'll have to use something newer.