It looks like the default cmark preprocessor doesn’t include a “tag” for generating a table of contents? I have used MultiMarkdown in the past so I just installed v6.6.0 and inserted a {{TOC}} in my document - select MultiMarkdown as the Markdown processor in the BBEdit preferences and I get a clickable TOC in the preview. I believe this is similar to what Jean recommended except using MultiMarkdown instead of Pandoc.
Good idea on the use of a preview template but in the end, I would need to have the preview window open to see or make use of the TOC. I have too many windows open as it is so I’m trying to avoid that option.
Other options I’ve explored:
Joplin - I have a co-worker who’s a big fan but our setup has been unstable (server at his location, everything encrypted, lost some files, etc.) so I’m avoiding this at the moment. Also not a big electron-based app fan but that’s a minor point. I do like the fact that you can easily toggle between plain text and markdown preview in the editor via a “Toggle editors” button. It also supports automatic TOC generation via [[toc]].
Obsidian - similar to Joplin in that you can easily switch views between plain text and processed. You can also open a parallel pane to see the processed text. Requires a plugin for TOC generation but it does seem to work well. The plugin includes some support for external editors (e.g. [/toc/], {{doc}}, [[__TOC__]], and [toc]). If the editor pane is set to source mode, you can’t see the TOC but if set to live preview mode, the TOC is visible and clickable (need to click an edit button to edit the TOC when in this mode).
I’ve been a Bbedit user since the earliest days so hoping to find a workable solution. Maybe a simple request to BBEdit support for a “toggle view” button in the editor window to switch between plain text and markdown preview mode!
Thanks,
Craig