How to Post a Code Snippet in Your Blog Post

You want to put a snippet of code in your blog to help others, right? And when you do, Blogger tries to execute the code and gives you an error message. Hmmm. What to do!


Here is a simple way you can tell Blogger not to execute the code, but just display it. You have to escape certain characters in order to tell Blogger that it's not executable code. So try this:

Go to a website called accessify.com. Copy your code and paste it in the box provided on this website. Then click Convert to Escaped Characters button. Copy the "escaped" code and paste it into your blog.

If you want fancy colored code, that is more difficult and is not addressed here, but on other websites.

What this site does is simple. It replaces certain characters, such as quote marks, with the text equivalent, e.g. ". This stops your blog from trying to execute the code by escaping certain characters.

It has always worked for us, and we're sure it will work for you as well. Good luck!

No comments:

Post a Comment