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

feat(toc): use markdown-toc directly to update inline #43

Merged
merged 4 commits into from
Feb 23, 2019

Conversation

myii
Copy link
Member

@myii myii commented Feb 23, 2019


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.

Copy link
Member

@javierbertoli javierbertoli left a 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
Copy link
Member Author

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?

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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>

Copy link
Member Author

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>
>
Copy link
Member Author

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.

@myii
Copy link
Member Author

myii commented Feb 23, 2019

Thanks for taking the time to review, @javierbertoli.

@myii myii merged commit 2c23866 into saltstack-formulas:master Feb 23, 2019
@myii myii deleted the PR_auto-md-toc branch February 23, 2019 16:52
@saltstack-formulas-travis

🎉 This PR is included in version 0.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants