Adding Code to Blogs


So I’ve been struggling a bit with finding an easy way for me to make my code examples look a little bit prettier when posting.

There’s only so many hours in the day and I just haven’t found the time to really dig into the best tool, theme, CSS, java script or some other cool way to make my code more readable in blog posts.

I recently stumbled across a cool little trick between GITHUB and WordPress that makes this little annoyance go away, at least for the mean time.  ***(If you’ve got suggestions or a better way, please post in the comments!)***

Essentially you create a GIST on the GitHub site. A GIST is essentially just another GITHUB repository and they can be cloned, forked, etc…  The nice thing is you can actually make the GIST public, allowing others to find your work, or create a secret GIST which means that only those with the URL can access it.

Once you’ve done that, you simply paste the URL into your wordpress blog. As long as you don’t paste it in as clear text and not as a embedded hyperlink.  If all you get is the URL, then you probably got it wrong.

But if you got it right….

Hope this helps someone else!

@netmanchris

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s