Step by Step Using Github as a Syntax Highlighter for Blog or Website
Step 1: Create a Gist
- Log in to Github
- Click the Gist link at the top of the screen (or go to gist.github.com)
- Fill out the file name (description is optional)
- Enter your code
- Click Create Public Gist
- Optional: You can also click Add File at the bottom to split your code snippet up into several different files if you need to.
Note: The syntax highlighting is auto-detected based on the extension of the file name that you enter, so be sure you add the appropriate level of detail.
Step 2: Embed your Gist
Once you create your Gist, you will be presented with a confirmation page. Click the show embed link and copy/paste the script tag on to your website.
Now, when your page is loaded, your code will be pulled in from Github and automatically formatted.
Its look like below
other way, which give download link,
- create github repository as public
- Copy your script
- Open script
- Click on RAW
- Copy the complete link and create hyperlink like below.