4

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?

1
  • I agree, this is really a pain in the a**. I can't find a single plugin that allows me to publish code easily. How all those blogs are doing that ? Writing posts in html only ?
    – Julien N
    Dec 16, 2011 at 17:26

2 Answers 2

2

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.