Syntax Highlighting?
-
Hello!
Just a brief question – I’m not sure how other people are going about this problem, but I was wondering if there is anyway to display code in posts that has been syntax-highlighted. I may have missed it, but I’m sure I’ve searched the control panel pretty thoroughly.
Thank you in advance for your time.
– Sébastien Reid
-
-
Gotta admit that I’m at a loss on the ‘syntax-highlighted’ bit as well. Do you mean displaying different colors within your code?
-
drmike: Essentially. Having some sort of plugin that will understand what language I say some blockquote is in, and format it accordingly. Here’s a fairly succint example: http://moodle.org/file.php/1/moddata/data/13/48/192/syntax-highlighting.png
-
Yup, had a feeling. (I use UltraEdit and the colors help a lot.)
Honest answer – not really. It’s come up a few times in the past but usually with spacing at the begining of lines (The rich text editor seems to like removing spaces at the begining of lines) and it’s boiled down to using font tags.
I don’t even know if there’s a plugin for the normal version of WordPress that would do this.
Sorry,
-drmike -
drmike, there most certainly is :) In fact, syntax highlighting is such an important feature for any development-related blog that not only is there a plugin for it, there is an entire plugin CATEGORY for it at codex.wordpress.org.
Here’s the relevant link: http://codex.wordpress.org/Plugins/Syntax_Highlighting
Any one of these would be a huge benefit to the WP.com community, I think :)
-
I second the need to make posts with syntax highlighting, or with expandable text boxes where users can copy and paste text. This is EXTREMELY important for anyone wishing to post code samples. WordPress also does NOT allow TXT file uploads (or other plain text source files like .java or .php).
Pretty please Matt/crew, Java syntax highlighting?!
-
Update: for Java code I found this free applet that can generate nicely formatted Java code in the eclipse style. For an example, see my blog post:
http://anatkinson.com/2007/01/23/java-scanner-examples/
For the tool, click the Java2Html converter here:
-
You just need to grab one of the many, many, many available blah-to-html syntax highlighting converters for your language of choice. Then take the generated HTML code and cut-and-paste it into a blog post using the CODE tab instead of the VISUAL tab.
an example on my blog using Perl Tidy as a generator.
Even if we had a plugin, it probably wouldn’t do everything you wanted it to so you’d end up using an external generator anyways. :)
- The topic ‘Syntax Highlighting?’ is closed to new replies.