Sub topic 9
Strikethrough, autolinks, and references to issues and people
This chapter assumes you can write basic Markdown links and have used issues and pull requests on GitHub. It covers three GitHub Flavored Markdown (GFM) features. Two of them behave differently in a README than in an issue comment, and that difference is the most common source of confusion.
Strikethrough
Wrap text in double tildes to draw a line through it. GFM also accepts single tildes, but double tildes work in more Markdown renderers, so use them.
Supports Node.js ~~14~~ 18 or later.Strikethrough is useful in a README for showing a dropped requirement or a deprecated option. In a changelog, a plain note such as "removed" is usually clearer.
Autolinks
GFM turns some plain text into links without any link syntax:
- A full URL starting with
http://orhttps://. - A domain starting with
www.. - An email address.
Docs: https://example.com/docs
Site: www.example.com
Contact: [email protected]To control the link text, use the normal [text](url) form. To make a link explicit, wrap it in angle brackets, as in <https://example.com>. Trailing punctuation is usually left out of the link, but a URL that contains parentheses or ends in an unusual character can be cut short. Use the bracket form for those URLs.
References to issues and people
In issues, pull requests, discussions, and comments, GitHub converts shorthand into links:
| You type | Result |
|---|---|
| `#123` | Link to issue or pull request 123 in the same repository |
| `owner/repo#123` | Link to issue 123 in another repository |
| `@octocat` | Link to a user, who is also notified |
| `@org/team` | Mention of a team in an organization |
| A commit SHA | Short link to that commit |
Fixes #123. See also octo-org/octo-repo#45.
Thanks to @octocat for the review.What changes in a README
Shorthand references are converted in conversation text. In a Markdown file stored in the repository, such as README.md, #123 and @octocat stay plain text, and nobody is notified. Only full URLs autolink there. If you want a README to point at an issue or a person, write the link yourself:
See [issue 123](https://github.com/OWNER/REPO/issues/123).
Maintained by [@octocat](https://github.com/octocat).Because of this, check the rendered README and click the links. Do not assume that text working in an issue comment will also work in a file.
Exercise
You write "Fixed in #88, thanks @octocat" in README.md and, after committing, see no links. Why, and how do you fix it?
Show answer
GitHub only converts #88 and @octocat into links in issues, pull requests, discussions, and comments, not in repository files. Replace them with explicit links, such as [#88](https://github.com/OWNER/REPO/issues/88) and [@octocat](https://github.com/octocat).