[kramdown-users] Creating ToC outside the document
t_leitner at gmx.at
Tue Oct 16 08:23:38 UTC 2012
On 2012-10-15 08:51 -0700 Matt Neuburg wrote:
> On Oct 15, 2012, at 6:25 AM, Thomas Leitner <t_leitner at gmx.at> wrote:
> > On 2012-10-15 18:34 +0530 Sandeep Laxman wrote:
> >> Hi Thomas,
> >> I was trying to use the same but I am still getting errors. I guess
> >> something is wrong with my code. My kramdown document is stored in
> >> @book.content.
> >> When I do the following:
> >> Kramdown::Converter::Toc.new(@book.content)
> > You have to do:
> > doc = Kramdown::Document.new(@book.content)
> > toc = doc.to_toc
> > The `toc` object then holds the (nested) elements of the table of
> > contents. You can output the table of contents in any way you like!
> > I.e. there is no predefined format (like nested `<ul>` lists).
> I don't see any of this in the documentation…! m.
This is described in the API documentation at
More information about the kramdown-users