psf / black

The uncompromising Python code formatter
https://black.readthedocs.io/en/stable/
MIT License
38.61k stars 2.43k forks source link

Docs: link change log entries directly to the issues #2087

Open felix-hilden opened 3 years ago

felix-hilden commented 3 years ago

It would be neat to be able to navigate from the changelog directly to the GitHub issues that are referenced. This can be very easily achieved with a Sphinx extension:

# conf.py
extensions = [
    'sphinx.ext.extlinks',
]
extlinks = {
    'issue': ('https://github.com/psf/black/issues/%s', '#'),
}

Then - Thing fixed (:issue:`31`) renders as "Thing fixed (#31)" with the link. Luckily it works unmodified for pull requests too, but adding another one would of course be trivial. I do recognise that it would mean converting the changelog from markdown to ReST, sacrificing readability of the plain text version. But I think that downside could be mitigated by moving the file to docs and linking users to the RTD site in readmes and whatnot.

The benefit is perhaps minimal, and since it changes things feel free to close this issue if it's not to your liking. Just came to mind while reading the documentation. Also, I would be willing to contribute this change.

ichard26 commented 3 years ago

We already switched our preferred Markdown flavour to MyST so this should be possible, the main limiting factor now is that our changelog check wouldn't support this at all right now. I've (well actually it's been really Cooper and I) been planning to rewrite it and export it into its own repo so it could be used for multiple repositories (i.e. Black, bandersnatch, and flake8-bugbear) without too much fuss, but I've been busy with other stuff.

I guess a workaround would be a Sphinx extension that automatically rewrites the changelog source on the fly, but that sounds complicated...

I like this idea don't get me wrong, but it's going to take some work, hence its "complex" marker.