The Jekyll gem uses a markdown processor called kramdown. When I want a
table of contents, I add this two-line directive to my markdown file:
* TOC
{:toc}
I suppose you could take a look at the source code for kramdown to see how
it works.
On Wednesday, August 10, 2022 at 5:26:05 PM UTC-4 craigh wrote:
> I see that there are various methods of generating a markdown table of
> contents (TOC) in markdown-specific editors or via plugins/scripts.
>
> For example, if I include <!—TOC—> in my doc.md file, then open it in
> Marked 2, Marked 2 will generate and display a table of contents at the top
> of the document. Looking at the html generated by Marked 2 shows that it’s
> doing something fancy in that it’s adding ids to each heading (e.g., <h2
> id="documents">Documents</h2>) and then has some magic (to me) at the top
> (<div class="mkrelocated-toc"></div>) to show the TOC.
>
> What I’m really looking for is something (probably a script?) that I can
> run while editing the .md file in bbedit to generate the TOC directly in
> the .md file. I’m guessing that having the TOC update itself automatically
> is asking way too much but I’d be happy just being able to delete an old
> TOC and regenerate a new one manually.
>
> Any suggestions?
>
> Thanks,
>
> Craig
>
>
> --
> Craig Heilman
> Bugaboo Software
>
>
>
>
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" rather than
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/d349434f-6544-4090-a3ee-5e151c7dcaafn%40googlegroups.com.