Skip to content

[Feature] Write the TOC somewhere in the markdown #7

@alanfranz

Description

@alanfranz

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions