https://github.com/kaihendry/toc
Creates a Table Of Contents
https://github.com/kaihendry/toc
contents document faq html navigation table toc
Last synced: 9 months ago
JSON representation
Creates a Table Of Contents
- Host: GitHub
- URL: https://github.com/kaihendry/toc
- Owner: kaihendry
- Created: 2016-06-01T14:29:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-01-10T04:43:58.000Z (about 5 years ago)
- Last Synced: 2025-04-18T16:55:26.705Z (9 months ago)
- Topics: contents, document, faq, html, navigation, table, toc
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Creates a table of contents from [h1, h2, h3, h4, h5, and h6 elements](https://html.spec.whatwg.org/multipage/semantics.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements)
[](https://travis-ci.org/kaihendry/toc)

An element with `data-fill-with="table-of-contents"` is filled with an ordered list of the headers.
This allows users to hyperlink directly to answers.
## Install
To install:
go install github.com/kaihendry/toc/cmd/toc
To keep upto date:
go get -u github.com/kaihendry/toc/cmd/toc
## Example
`foo.html` contains:
FAQ
How do I create a FAQ?
Like this!
Run the tool over the HTML
$ toc foo.html
And something like the following should print to `/dev/stdout`
FAQ
How do I create a FAQ?
Like this!
As used on:
*
## Acknowledgements
Many thanks to [tabatkins's bikeshed](https://github.com/tabatkins/bikeshed) for the inspiration & the most helpful [Golang programmer I know, Zoltan](https://github.com/zgiber).