I was thinking you could have your Markdown window on one side of your 
screen and BBEdit's preview window (which is HTML) on the other side. 
Changes to the Markdown file show virtually immediately in the preview 
window. You could even create a preview template with the TOC tag in it so 
you wouldn't have to add that to each working file in order for it to 
appear in your preview window.

On Thursday, August 11, 2022 at 8:12:14 AM UTC-7 craigh wrote:

> Thanks for the good ideas but all those solutions only seem to show the 
> TOC in the markdown preview. I probably wasn’t clear enough that the main 
> goal is to *generate the TOC in the .md file and have it display in the 
> .md file while still editing in BBEdit.*
>
> I’d prefer to not have to manually add any special attributes such as <a 
> name=“my section name"></a> to each header as some tools require but that 
> wouldn’t be a show stopper.
>
> For example, after putting the insertion point at the start of my document 
> (or not doing that if the script is smart enough to do it for me), then 
> running the script/plugin/etc. I’d expect to see the TOC inserted at the 
> start of the document or just below the “title” (H1 header). Something 
> similar to the following...
>
> *Before*
>
> Document Title
> ==============
>
> ---
> ## Section One
>
> Blah
>
> ---
> ## Section Two
>
> Blah blah
>
>
>
> *After without clickable links*
>
> Document Title
> ==============
>
> ---
> ## Table of Contents
> 1. Section One
> 2. Section Two
>
> ---
> ## Section One
>
> Blah
>
> ---
> ## Section Two
>
> Blah blah
>
>
> *After with clickable links*
>
> Document Title
> ==============
>
> ---
> ## Table of Contents
> 1. [Section One](#section-one)
> 2. [Section Two](#section-two)
>
> —
> <a name="section-one"></a>
> ## Section One
>
> Blah
>
> ---
> <a name=“section-two"></a>
> ## Section Two
>
> Blah blah
>
> Thanks,
>
> Craig
>
> On Aug 11, 2022, at 1:13 AM, Craig Maynard <coremem...@gmail.com> wrote:
>
> 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 "sup...@barebones.com" 
> 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 bbedit+un...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/d349434f-6544-4090-a3ee-5e151c7dcaafn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/bbedit/d349434f-6544-4090-a3ee-5e151c7dcaafn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> Craig Heilman
> Bugaboo Software
>
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" 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 bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/42d62042-89c2-424a-99b1-01827061ce31n%40googlegroups.com.

Reply via email to