Generate a dynamic table of contents based on (already) rendered headings with Rails -
many wikis have it, table of contents based on headings displayed page. i'm looking easy possibility realize rails.
i have different kinds of pages, dynamically generated ones, processed markdown pages static pages. these pages have html headings on different levels. how can generate wiki table of contents, links headings anchors?
i searched post render callback or entry point in life cycle, happening after rendering, didn't found one. suggest do? .. implementing middle ware or direction?
if decide stick markdown content, can redcarpet gem. passing with_toc_data: true
renderer add anchors header tags. , re-rendering redcarpet::render::html_toc
generate list of links linking header tags.
Comments
Post a Comment