less than 1 minute read

This will be a very short post about a neat little feature I stumbled upon last week.

On $WORK Slack someone had asked if it was possible to reference code from a GitHub repo in a Markdown file, aside from copying and pasting the entire code, putting it in a code block, and specifying the right Markdown sytanx highlighter.

Here’s a quick way to get your code to show up in your README.

Check out the repo here: https://github.com/stevemar/code-reference-in-readme

  1. Go to the source code you want to copy, highlight it, click on the context menu and choose Copy permalink.

    get-link

  2. Past the content into a Markdown file.

    paste-in-markdown

  3. See the code reference in all of its glory!

    paste-in-markdown

Done!

Updated: