-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat(toc): use markdown-toc
directly to update inline
#43
Conversation
* https://github.com/jonschlinkert/markdown-toc - Generate a markdown TOC (table of contents) for any markdown files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty cool, @myii
# Update Tables of Content in the relevant `.md` files | ||
- npm install markdown-toc -D | ||
- markdown-toc -i CONTRIBUTING.md | ||
# - markdown-toc -i README.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've put this in here since using README.md
is common across our repos. That also begs the question -- should we modify the .rst
to .md
in this repo, too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make me answer quickly, I'd say that md
is more common in github projects, but sincerely don't know. I'm OK with both of them (use rst mostly when I have to write pdfs parsing them with rst2pdf), but I'm no strongly biased for one over the other.
If you know there's a recommended one for github projects, I'd say let's use that one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not endorsing any particular format, I have to accommodate for three (I prefer asciidoctor
myself). Looking at the wider picture, Markdown is the most common, making the barrier of entry lower (i.e. for contributions). The solutions we're currently using for automation usually work best for, or are limited to, Markdown files. Then it simply becomes an issue of consistency of formats across the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is comparison of RST and MD here: http://hyperpolyglot.org/lightweight-markup
I have used both, have preferred rst when I want to include media/links in the markup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@noelmcloughlin Thanks for that. None of us is doubting which is the superior format. This is really about which is the most accessible, both for other contributors as well as the automated solutions that we're introducing. From that angle, Markdown can't be denied. We're using it throughout GitHub and everywhere else, wherever heavy-lifting isn't required. And the docs stored in the main repo are hardly going to be that. If we ever get around to producing some serious documentation or even populating the formulas' wikis, the other formats come into their own.
<!-- toc --> | ||
<!-- tocstop --> | ||
</td></tr></table> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I toyed with keeping this simpler (without the table) but found that it is much nicer with it. This would be a standard copy-paste block that will then be filled automatically by markdown-toc
during the release phase.
@@ -19,7 +27,7 @@ type(scope): subject | |||
Besides the version bump, the changelog and release notes are formatted accordingly. | |||
So based on the example above: | |||
|
|||
> ### Documentation | |||
> <h3>Documentation</h3> | |||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the workaround when quoting text with headers. Really, markdown-toc
should handle this but it would mean maintaining our own fork.
Thanks for taking the time to review, @javierbertoli. |
🎉 This PR is included in version 0.6.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Our Markdown files are quite lengthy, with content still to be added. Having a TOC is invaluable but manual maintenance is a pain. Using the available package linked above, the process of maintaining the TOC across all relevant files is automated during the Travis
semantic-release
run.