Announcing Prismatic for WordPress! Prismatic is a free WordPress plugin that enables you to display beautiful syntax-highlighted code using either Prism.js or Highlight.js. Prismatic also escapes code snippets on the front-end, in the Admin Area, or both. There’s even an option to escape code snippets without syntax highlighting, so you can apply your own custom styles. Prismatic is fast, free, flexible, and loaded with features. Read on to learn more..
Over 80+ Themes
Prismatic lets you choose between two of the most popular syntax-highlight libraries — Prism.js and Highlight.js — so you get over 80 syntax themes to choose from, plus some great built-in functionality, including line numbers, line highlighting, and show language. Other features include limiting highlighting to WP Posts and Pages, smart loading of assets, and support for no-prefix class names (for Highlight.js).
Supported Languages
Here is a list of languages supported when using the Prism.js library.
Language Class
Apache = apacheconf
AppleScript = applescript
Bash = bash
C = c
C# = csharp
C++ = cpp
C-like = clike
CoffeeScript = coffeescript
CSS = css
Diff = diff
Git = git
HTTP = http
Ini = ini
Java = java
JavaScript = javascript
JSON = json
Makefile = makefile
Markdown = markdown
Markup = markup
NGINX = nginx
Objective-C = objectivec
Perl = perl
PHP = php
Python = python
Ruby = ruby
SASS = sass
SCSS = scss
SQL = sql
Twig = twig
YAML = yaml
And here is a list of languages supported when using the Highlight.js library:
Language Class
Apache = apache, apacheconf
Bash = bash, sh, zsh
C# = cs, csharp
C++ = cpp, c, cc, h, c++, h++, hpp
CSS = css
CoffeeScript = coffeescript, coffee, cson, iced
Diff = diff, patch
HTML/XML = xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist
HTTP = http, https
Ini = ini
JSON = json
Java = java, jsp
JavaScript = javascript, js, jsx
Makefile = makefile, mk, mak
Markdown = markdown, md, mkdown, mkd
Nginx = nginx, nginxconf
Objective-C = objectivec, mm, objc, obj-c
PHP = php, php3, php4, php5, php6
Perl = perl, pl, pm
Python = python, py, gyp
Ruby = ruby, rb, gemspec, podspec, thor, irb
SQL = sql
If you are using a language that you don’t see here, drop a line — I’m more than happy to add more :)
Code Escaping
In addition to syntax highlighting, Prismatic also escapes code snippets. You can enable code escaping when using Prism.js, Highlight.js, or neither. So if you just want to display cleanly escaped code without any syntax highlight applied, enable the “Plain Flavor” option and you’re good to go. For each of these three options — Prism.js, Highlight.js, or Plain Flavor — Prismatic gives you fine-grained control over where your code snippets are escaped:
- Enable code escaping for post content, excerpts, and/or comments
- Enable code escaping on the frontend, Admin Area, or both
- Escapes single-line and multi-line code snippets
So when code escaping is enabled for either/both the frontend or Admin Area, the plugin makes the following changes to any code contained within <code>
tags:
\r removed
& replaced with &
< replaced with <
> replaced with >
trailing whitespace removed
That’s it — no other changes are made to code snippets. Check out the Prismatic documentation for more details.
Get Prismatic
Prismatic is designed for optimal performance, flexibility, and security. Display your code in style, easily and beautifully with Prismatic for WordPress. To learn more about Prismatic, check out the launch post at Perishable Press, or hit the WordPress Plugin Directory for complete documentation and free download: