[kramdown-users] Creating ToC outside the document

Matt Neuburg matt at tidbits.com
Mon Oct 15 15:51:10 UTC 2012

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.

matt neuburg, phd = matt at tidbits.com, http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com

More information about the kramdown-users mailing list