Table of contents for markdown pages
sswatson opened this issue · comments
Is there a convenient way to do a table of contents in a markdown (non-post) page? My first thought was to use a markdown template and call @tableofcontents[]
, but that function isn't available from scribble/text
, and calling require
makes the template renderer complain that requiring can only happen at the top level.
Off the top of my head I can't think of a convenient way.
-
I have sometimes generated one manually: Observed the
id
values inh1
etc. elements (Frog generates "slugs" from the content) and typed out the ToC links myself. -
If I had a page long enough to benefit from a table of contents to its own sections, I might author it using Scribble instead of markdown format, and directly use
table-of-contents
. -
As for
require
: Uselocal-require
in templates.