Why Put Your Source Code Snippet into Syntax Highlighting Editor

If you are putting a lot of source code snippets into your blog for demonstrative purpose, you will soon realize that it is not a wise choice to let the source code snippets to be part of the post in your blog. By doing so, it will cause the source code to be inaccurate when it is copied out and paste into another file. In another words, your readers who are interested in your source code and are trying to copy directly from your post may end up not working.

The reason is some of the quotes like the apostrophe ( ' ) may turn into acute or grave accent quote ( ` ) during the copying process. The former is a single quote found under the double quote ( " ) on the keyboard while the latter is slightly slanted single quote found under the tilde ( ~ ). They look quite similar but make a whole lot of difference during coding. This is the most common problem but most of the times were overlooked. The author would say that the code work perfectly for him/her but it would not work for his/her readers. This is because the code has accidentally changed during the process of copying.

Benefit of Syntax Highlighting Editor
Therefore, the safest way to show your source code snippets on your blog is to put it into a form of syntax highlighting text editor. This not only ensured the source code copied out will remain 100% accurate but also allow easy readability.

Most syntax highlighting text editor has features to show the code in different colors and fonts. It helps to distinguish between programming languages, comments and errors. In addition, it has features such as View Source, Copy to Clipboard, Print and About the Editor. All these four little icons will appear when you mouse-over the code. You can see the example by mouse-over the code below.

/* Post Divider */
body.custom div.post {
background: transparent url(URLOfImage/nameOfImage.jpg);
border: none;
background-repeat: no-repeat;
background-position: bottom center;
}
/* End of Post Divider */

Now, the correct way of copying the code to your file is while you mouseover the code, click on the little icon showing 2 documents together, it is actually the "Copy to Copyboard" function. Once you have copied, paste the code into your file.

Syntax Highlighting Editor
The most common used syntax highlighting editor on the web is the SyntaxHighter and the latest version is 2.1.364. If you are interested to add a syntaxhighter to your blog or website, click here to download a copy.

Click here for installation and configuration of SyntaxHighter to your blog. You can also check out SyntaxHighter discusson forum if you have any question.

Comments

Popular posts from this blog

Headway Visual Editor not Loading in the Browser