Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TOC in the README.md #43

Open
bwood opened this issue Oct 18, 2015 · 7 comments
Open

Fix TOC in the README.md #43

bwood opened this issue Oct 18, 2015 · 7 comments

Comments

@bwood
Copy link
Collaborator

bwood commented Oct 18, 2015

Tasks:

  1. Find automatic way of generating a table of contents for GitHub-style markdown. The preference is for a script that can be run from the command line.
  2. Use the script to update the README.md and make a pull request.
@bwood
Copy link
Collaborator Author

bwood commented Oct 18, 2015

@honzi writes:

I found a Chrome userscript at https://github.com/tomancaklab/tomancaklab.github.io/blob/master/gfm-add-toc.user.js that seems to generate an accurate TOC for markdown files. It's limited to the wysiwyg editor for GitHub repository wiki files, as that seems to be drastically different from the wysiwyg editor for files within the repository. Copying and pasting the README.md file into a wiki file editor will generate a pretty accurate TOC that can be copypasted back into the README.md file. I'll try to create a Chrome extension that does this for all GitHub files, but the complex editor that GitHub uses for repository files may be too complex.

@bwood
Copy link
Collaborator Author

bwood commented Oct 18, 2015

@honzi: My preference would be to find a script that can be run from the command line. This way it could be easily called from a script like rebuild.sh. That would allow us to automate the TOC creation as part of a release build.

@honzi
Copy link
Contributor

honzi commented Oct 19, 2015

@bwood: I had a feeling that a GUI-approach wouldn't be ideal, so I did some more digging. I found isaacs/github#215 which is an unofficial issue related to this issue, which may have the answer.

They mention a few command line based options, such as:

According to isaacs/github#215 (comment) GitHub already supports AsciiDoc, which can easily display a table of contents automatically. This would mean nothing would have to be added to any build scripts, but it would mean that the readme would have to be modified with AsciiDoc markup. The TOC being rendered only when viewed via GitHub or other markdown renders would mean that the TOC wouldn't be in the readme file, however.

@bwood
Copy link
Collaborator Author

bwood commented Oct 19, 2015

Thanks for the links! This sure is an ongoing issue! On a super-quick look this one looks good to me: https://github.com/thlorenz/doctoc Want to try that out and maybe compare it to any others you think are good?

@honzi
Copy link
Contributor

honzi commented Oct 22, 2015

Sure. I'll have a chance to try out various options over the weekend of the 24th.

@honzi
Copy link
Contributor

honzi commented Oct 25, 2015

Of the three I found, I definitely agree that https://github.com/thlorenz/doctoc is the easiest to use. Installation was a breeze and it generated TOC's for README.md as well as CHANGELOG.md. It changes the files without committing anything via git, so it can easily be integrated into build scripts in any way you would like.

@bwood
Copy link
Collaborator Author

bwood commented Oct 26, 2015

Thanks Jan. I'll give this a try. Appreciate your help!

@bwood bwood removed the wontfix label Dec 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants