prism.js – How to enable code snippets on a Worpress-powered blog

Thanks to David Walsh, now my blog is powered by PrismJS, a very powerful syntax highlighting plugin based on pure JS (so yes, is it YOU that are rendering this beautiful code snippets!)

This is just a sample page, where I want to test some Java, HTML, CSS, JS, XML, YAML and JSON.

Some HTML:

<html>
  <body>
    <div>
      <p>I'm some code.</p>
    <div>
  </div></div></body>
</html>

Few lines of XML:

< ?xml version="1.0" encoding="utf-8"?>
<root>
  <node with-attribute="valueof"></node>
</root>

Yes, I need CSS:

p { color: red !important; }

But more important, Java:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello, World");
    }

}

And..yes, it works pretty fine!
Thanks also to Chris Coyer article on Worpress tricks on code posting and to this quick how-to

Latest articles

Matteo Pelucco Written by:

One Comment

  1. December 2

    Hello Matteo ,
    Google can read it CSS, JS ?

Leave a Reply to kumop

Your email address will not be published. Required fields are marked *


+ 7 = thirteen