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

Written by:

Be First to Comment

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *


sei + = 12