How to create automatic links via [Github Markdown] within CHANGELOG?

I’ve noticed a few different changelogs around on GitHub that follow the keepachangelog format, and have auto-created links for each version that link to the diff between the previous version and that version. See:

https://github.com/olivierlacan/keep-a-changelog/blob/master/CHANGELOG.md

Looking at the raw text, it includes

## [1.0.0] - 2017-06-20

but the GitHub Markdown-ified version shows “1.0.0” as a link to a diff between the previous version (0.3.0) and 1.0.0. When I created a CHANGELOG with the same format (see https://github.com/carpeliam/concourse-status-amplifier/blob/master/CHANGELOG.md), it has no such cool formatting. How does one get cool CHANGELOG diff formatting?

The [foo] syntax is a shorter (and rarely used) way of writing [foo][foo]. So if you look at the bottom of the file you reference, you’ll see:

[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0...HEAD
[1.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.3.0...v1.0.0
[0.3.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.8...v0.1.0
[0.0.8]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.7...v0.0.8
[0.0.7]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.6...v0.0.7
[0.0.6]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.5...v0.0.6
[0.0.5]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.4...v0.0.5
[0.0.4]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.3...v0.0.4
[0.0.3]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.2...v0.0.3
[0.0.2]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.0.1...v0.0.2
[0.0.1]: https://github.com/olivierlacan/keep-a-changelog/releases/tag/v0.0.1

These are link reference definitions. And you’ll see that [1.0.0] links to https://github.com/olivierlacan/keep-a-changelog/compare/v0.3.0…v1.0.0 which is specifically the way to tell GitHub to visualize the diff between the tags v0.3.0 and v1.0.0.

I hope that helps!

2 Likes

Thanks Lee, that did it!