Skip to:

Re: needs a common place to share code snippets

Lance Willett


Thanks for the great replies and discussion! If the snippet blog is a possibility, one thing we’ll need to clearly document for the snippet authors is how to show syntax highlighting in their posts.

Paste bins make you choose from a dropdown menu, but that works for that one snippet. A blog post detailing a technical fix for something might have 3 or 4 such snippets in different languages (PHP, Apache file, INI file, CSS, HTML, etc).

I guessed by looking at the other Codex pages (and at the names of the included JavaScript files) that the Codex was using a syntax highlighter plugin that accepted the following shortcode:

[sourcecode language='php']

Andy, if you could confirm a few of those “authoring” details it will be a big help I think. The most common languages needed would probably be something like:

  • Plain text
  • Apache
  • Bash (command line)
  • CSS
  • HTML
  • INI file
  • Javascript
  • MySQL
  • PHP

The bash, Apache, and INI would probably be displayed OK with “plain text” — but we should just make sure that the plugin the blog uses for syntax highlighting does the other languages well.

Skip to toolbar