I am really frustrated with availible Syntax Highlighter’s on the market it seems that no matter which one I use, after pressing “Save Draft” or “Publish” and after I change from Visual to Html or reverse I am loosing the xml snippet code. Also, other code (C#, PHP) just loosing their style, especially break lines making code unreadable. My configuration is
- WordPress 3.2.1.
- Easy Google Syntax Highlighter,
- SyntaxHighlighter TinyMCE Button,
- SyntaxHighlighter
I really like WordPress however writing and espessially editing posts in admin panel, which is very handfull, make it impossible because it just looses and stripping code formating.
So, the question is which plugins do you use or do you write posts through admin panel?
Your best bet is to use custom post meta to store the code, and output it however you want. In other words, skirt the editor entirely. Here’s a really clever WP theme by Dan Cederholm that does this like a champ.
A nice solution to this problem is by using the “gist” feature of github. Simply create a gist with one or more files on github and embed them in your wordpress post like this:
[gist file=FILENAME.xml]GIST-ID[/gist]
You can leave the filename if you have only one file or want to display all files.