swift-doc icon indicating copy to clipboard operation
swift-doc copied to clipboard

Add link to the GitHub repo

Open sindresorhus opened this issue 4 years ago • 2 comments

I would like to have a link back to the GitHub repo from the docs.

Jazzy automatically shows a link in the top-right corner of the docs site if you specify the repo URL in their config: https://github.com/sindresorhus/KeyboardShortcuts/blob/498fcd6cc1562313b5e3aa97b35430cfb2c91292/.jazzy.yml#L2

Screenshot 2020-05-21 at 14 25 16

Live example: https://sindresorhus.com/KeyboardShortcuts/

sindresorhus avatar May 21 '20 06:05 sindresorhus

This is definitely something I'd like to support. Jazzy uses a github_url setting, but I'd like to keep the amount of configuration to a minimum (however much of an uphill / losing battle that may be).

My current plan is to read the remotes from git to determine where the code is hosted publicly, and implement logic that route source location to URLs for the most popular websites (GitHub, GitLab, BitBucket, etc.) The advantage here is that we can use other information from git like the commit reference to provide permalinks, which won't break if methods move around between versions.

mattt avatar May 23 '20 16:05 mattt

I think there was a discussion here somewhere about configs to allow swift-doc to become more configurable, but I don't remember PackageConfig being mentioned anywhere. So here's the link for posterity 🙂

MaxDesiatov avatar Jun 15 '20 18:06 MaxDesiatov