Setup
- Download a distribution
- Include the script and stylesheets in your document (you will need to make sure the css and js file are on your server, and adjust the paths in the scriptand link tag)
<link href="prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="prettify.js"></script>
- Add
onload="prettyPrint()"
to your document's body tag. - Modify the stylesheet to get the coloring you prefer
Usage
Put code snippets in <pre class="prettyprint">...</pre> or <code class="prettyprint">...</code> and it will automatically be pretty printed.
The original | Prettier |
---|---|
class Voila { public: // Voila static const string VOILA = "Voila"; // will not interfere with embedded tags. } | class Voila { public: // Voila static const string VOILA = "Voila"; // will not interfere with embedded tags. } |