Table of Contents

(I almost forgot to post this, whoops!)

My blog posts can get quite long, so I use headings to break them up into sections by topic. I want readers to navigate around easily, so I’m requesting a quick way to insert a table of contents with links to headings inside a post.

I suppose I can do this by hand, but I’m not sure if the particular Markdown flavor that weblog.lol uses also supports anchor links within a page.

5 Likes

I was looking for something else entirely, but came across this list of CommonMark extensions that weblog (currently?) uses and a link to more, if you want to request another one.

It looks like you would want “Table of Contents” which is not currently installed (according to that list above). I have been doing this same type of linking in some posts and have been manually creating the connection, but I think this would be useful to request, so +1 to get this in!

3 Likes

I’ll look into installing this shortly! Thanks for the excellent suggestion.

2 Likes

I am adding a cross-link to another extension request in hopes that one or the other getting done would mean the other could too: CommonMark extension request

1 Like

@darylsun, sorry for the delay — I’ve been looking into this, and the issue is that the TOC plugin is kind of an all-or-nothing deal — if enabled, it will generate a TOC for everyone, everywhere, which is probably not ideal. What I need to do is either figure out a way to enable it selectively, or roll my own {toc} tag that anyone could use. Stay tuned for an update on this soon!

1 Like

@darylsun, false alarm! Turns out there’s a lot of really nice configuration available, and I worked out all of the placeholder and positioning stuff.

You can now use {toc} in any post or page where you want a TOC, and it’ll generate one automatically based on the page heading structure.

Enjoy!

2 Likes

Awesome! I wondered about this all or nothing bit too, glad there were options.

2 Likes

Sweet! I’ll have to try that out later. I’ll update y’all on how it goes.

I’m so sorry for the late feedback… I got distracted by other things :sweat_smile:

Anyway, I tried this out just now, and it seems the Table of Contents include the blog post title in the outline. Is that intentional?

Oh, great catch. I’ve adjusted the configuration to omit heading level 1 (since we use that for the post title). Thanks for pointing it out!

1 Like

Okay, it looks great now! Thank you very much!

1 Like