ekalinin/github-markdown-toc.go

[Feature] Replace TOC comment in place on a folder

gedw99 opened this issue · 2 comments

Looks for an annotation in a markdown file that represents the TOC

Use markdown comments to indicate where the TOC is to be placed in a file.

A markdown file would look like this:

TOC START comment
the actual toc
TOC END comment

The logic steps are:

  1. Walk files

  2. For each .md

  3. Find the TOC comment annotation in that .md

  4. Create the toc.

  5. Inject into the markdown one line below the TOC and another annotation of TOC END

  • The TOC END is important because it tells the logic where the insert ends.

@gedw99 If you use Bazel, I wrote a rule that does what you are describing. Behind the scenes, it uses github-markdown-toc.go to generate the TOC.

Repository that uses the markdown TOC generation.

It’s ok I wrote a golang func to do it.

I know Barzel but don’t want to use it