Goto dashboard, and click Editing HTML under the Layout tag, add the following two lines in the <head> tag
<link href="http://xxx.org/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="http://xxx.org/prettify.js"></script>
The next thing is to find the <body> tag and change it to
<body onload='prettyPrint()'>
Ok, you are done and you can create a post testing this feature. For example, creating a post with the following code
<pre class='prettyprint'>
class Voila {
public:
// Voila
static const string VOILA = "Voila";
// will not interfere with embedded tags.
}
</pre>
and here is the result
class Voila {
public:
// Voila
static const string VOILA = "Voila";
// will not interfere with embedded tags.
}
PS: Made some improvement to the prettify style and add overflow: auto; for pre.prettyprint
pre.prettyprint { padding: 2px; border: 1px solid #888; overflow: auto;}
2 comments:
It is too bad that some code is cropped if the line is too long. There is no scrollbar support for this.
yes. thanks for post )
Post a Comment