Title: Displaying Code
Last modified: August 18, 2016

---

# Displaying Code

 *  [Cam](https://wordpress.org/support/users/cam/)
 * (@cam)
 * [21 years, 11 months ago](https://wordpress.org/support/topic/displaying-code/)
 * Does anyone know of a good WP hack/plugin that makes the display of code in posts
   easier?
    I’m thinking of something along the lines of MT’s CodeBeautifier plugin—
   you can specify the language and it handles syntax highlighting and makes it 
   all pretty.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [carthik](https://wordpress.org/support/users/carthik/)
 * (@carthik)
 * [21 years, 11 months ago](https://wordpress.org/support/topic/displaying-code/#post-69305)
 * Neat idea for a plugin! Right now, you can look in [http://wiki.wordpress.org/Plugin](http://wiki.wordpress.org/Plugin)
   to see a list of all available plugins to see if there is one that does this.
 *  [mindlesslemming](https://wordpress.org/support/users/mindlesslemming/)
 * (@mindlesslemming)
 * [21 years, 11 months ago](https://wordpress.org/support/topic/displaying-code/#post-69328)
 * [It’s already been done](http://scott.yang.id.au/2004/05/syntax-hilight-enscript/)
 *  [stevarino](https://wordpress.org/support/users/stevarino/)
 * (@stevarino)
 * [21 years, 11 months ago](https://wordpress.org/support/topic/displaying-code/#post-69337)
 * While I think the script is great, it relies on the language tag (`lang`) to 
   determine the computer language. I believe that’s actually against the [w3c’s standard](http://www.w3.org/TR/REC-html40/struct/dirlang.html#h-8.1.1):
 * > The lang attribute’s value is a language code that identifies a natural language
   > spoken, written, or otherwise used for the communication of information among
   > people. Computer languages are explicitly excluded from language codes.
 * Basically [RFC 1766](http://www.ietf.org/rfc/rfc1766.txt) sets the stage on what’s
   an acceptable language for the tag and what’s not:
 * > The language tag always defines a language as spoken (or written) by human 
   > beings for communication of information to other human beings. Computer languages
   > are explicitly excluded.
 * Also the plugin uses `pre` tags for markup. I believe `code` would be a better
   choice, with the content’s language specified by the class attribute. This allows
   greater flexiblity in the code’s output such as inline code samples.
    Sorry for
   the outburst and rant. I’m really interested in the plugin and must check it 
   out later. But I have a few ideas I want to try with what I believe is a different
   motivation to aim for.
 *  Thread Starter [Cam](https://wordpress.org/support/users/cam/)
 * (@cam)
 * [21 years, 11 months ago](https://wordpress.org/support/topic/displaying-code/#post-69405)
 * First up, thanks all for the replies.
    From what I’ve seen,  displays inline (
   correct?) this is pretty easy to change to `display: block;` using CSS, so I'm
   not too worried about that. In terms of the existing plugin, the 'lang' thing
   does concern me, though. When I changed over to WP, I tried to build my site 
   so that it validates as XHTML 1.0 Strict. Although the 'lang' attribute would(
   almost) certainly pass muster with the validator (unless it is invalid for the`
   <pre>` tage or validates the attributes against some list so only values like'
   en-us' or whatever would pass), I think using it would violate the spirit of 
   the standard, which is bad karma in my book. I know beggars can't be choosers,
   so I guess it's a question of either shutting up or doing it myself. (I'm only
   starting out with the whole PHP thing, but it's something I'd definately like
   to have a crack at when I get more proficient, and the whole reason I was after
   something in the first place was so that I could document what I have learned
   and publish the code I have written to date.)

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Displaying Code’ is closed to new replies.

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 4 replies
 * 4 participants
 * Last reply from: [Cam](https://wordpress.org/support/users/cam/)
 * Last activity: [21 years, 11 months ago](https://wordpress.org/support/topic/displaying-code/#post-69405)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
