github-markdown-toc.go
github-markdown-toc.go copied to clipboard
[Feature] Write the TOC somewhere in the markdown
Hello, thanks for the tool.
There's one feature I'd really like in it: the ability to directly manipulate a Markdown file and inserting the TOC in a specific place, in order to make the update automatic.
Let's suppose a README.md like
## Hello
asdasdasd
## Table Of Contents
xyahdyshasyhd
### Other title
I'd like to do something like
gh-md-toc insert-toc-at "Table Of Contents" README.md
And I would get on stdout the FULL README.md, with whatever was inside the "Table Of Contents" replaced by the TOC:
## Hello
asdasdasd
## Table Of Contents
* [Hello](#hello)
* [Table Of Contents)(#table-of-contents)
* [Other title](#other-title)
### Other title
I suppose I could achieve a similar result in bash with awk/sed/similar tools, but IMHO this feature would be quite in line with gh-md-toc purpose.
I'm no go expert, but if you think you don't have time to do it but you would accept a PR for it, I can try coding it myself.