4

WordPress.com uses Alex Gorbatchev’s SyntaxHighlighter so all you need to do is use the right shortcode ex: [code language="css"] #button { font-weight: bold; border: 2px solid #fff; } [/code] which gives you something like this: it has more features and you can see a list of supported languages at http://en.support.wordpress.com/code/posting-source-code/


3

HTML language includes a special tag for displaying inline code. To apply it to your text, switch to the 'Text' visual editor tab and place the <code> tag before your bit of code, and the </code> tag afterwards. If you want to use the backtick ` character for highlighting code like you do on Stack Overflow, check out this plugin by Tom McFarlin.


3

I face this issue quite often on my own site where I publish code tutorials. Unfortunately, there isn't a good solution. Instead, I recommend this workflow: Use the WYSIWYG editor to build your article content leaving placeholders for your code snippets. Switch to the HTML editor to add your code snippets The visual editor (TinyMCE) tries to escape code-...


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.


2

I've found that you have to wrap code formatting shortcodes in pre tags.


2

First of all you should use the standard pre and code elements instead of blockquotes. But if have too many to change them, there might be a workaround. If you only use blockquotes for code, then you can use a bit of jQuery to convert those to pre tags, but make sure to do that before Prettify is loaded. I don't know how the plugins work, but I can help ...


2

Try SyntaxHighlighter Evolved. I believe it will work for your needs.


1

It turns out that this well maintained plugin is a drop in replacement. I installed this and all is well again. It's called syntax highlighter evolved. https://wordpress.org/plugins/syntaxhighlighter/


1

WordPress replaces those characters when you are in the VISUAL editor. If you are writing a bunch of code, turn it off, and only write/save in the TEXT or HTML view. EDIT: I just realized the "bulk edit" part of this question. I use a scary but powerful plugin called Search Regex for this type of thing.


1

This one should work add_filter( 'the_content', 'pre_content_filter', 0 ); function pre_content_filter( $content ) { return preg_replace_callback( '|<pre.*>(.*)</pre|isU' , 'convert_pre_entities', $content ); } function convert_pre_entities( $matches ) { return str_replace( $matches[1], html_entity_decode( $matches[1] ), $matches[0] ); } ...


1

Have you looked to see if the correct style sheet is being loaded to change the highlighting? It appears to be a white background with some font styling for the different language. If you want something more than that, you will need to customize the css for it.


1

Another option is to put your code snippets into Gist, and use the Embed GitHub Gist plugin. Works well, and has the advantage that your code is revision controlled and can be easily forked.


1

Solved it. A real RTFM moment. The FAQ for CodeColorer makes a note about this (though it's not mentioned in the main how-to text). Using the escaped = "true" code in the [cc] tag brings back the behaviour I was looking for – now it's possible to write the <- operator in Visual (and it becomes &lt in HTML), but the published post displays <- ...


1

I've installed the Ultimate TinyMCE plug-in. It is a bit of over-kill for syntax highlighting, but it does provide that functionality. The setting is under button group 2. It's called "HTML Code Magic Button". It does a good job of formatting and highlighting. It didn't like my <br style="clear: both"> nor my <p style="clear:both;"></p>. It ...


1

I was looking forever for the solution. I finally found this plugin which actually does a lot of things. But i only used the option to add a HTML button to the row of buttons which lets you edit post/page html with CodeMirror (http://codemirror.net/) highlighting. Link to plugin: http://wordpress.org/extend/plugins/ultimate-tinymce/


Only top voted, non community-wiki answers of a minimum length are eligible