Full width home advertisement

Post Page Advertisement [Top]

How to use google-code-pretiffy

Default blog code

<div dir="ltr" style="text-align: left;" trbidi="on">
</div>

Use this script

Add the minimal script before the default blog code

<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script><style>li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:decimal!important}.str{color:#EC7600}.kwd{color:#93C763}.com{color:#66747B}.typ{color:#678CB1}.lit{color:#FACD22}.pln,.pun{color:#F1F2F3}.tag{color:#8AC763}.atn{color:#E0E2E4}.atv{color:#EC7600}.dec{color:purple}pre.prettyprint{border:0 solid #888}ol.linenums{margin-top:0;margin-bottom:0}.prettyprint{background:#000}li.L0,li.L1,li.L2,li.L3,li.L4,li.L5,li.L6,li.L7,li.L8,li.L9{color:#555;list-style-type:decimal}li.L1,li.L3,li.L5,li.L7,li.L9{background:#111}@media print{.kwd,.tag,.typ{font-weight:700}.str{color:#060}.kwd{color:#006}.com{color:#600;font-style:italic}.typ{color:#404}.lit{color:#044}.pun{color:#440}.pln{color:#000}.tag{color:#006}.atn{color:#404}.atv{color:#060}}pre{white-space:pre-wrap}</style>

Insert code

Put the following code inside the default blog page code.
Example: Say the following code is X
then

<pre class="prettyprint linenums lang-xml">
	X
</pre>

Code Example

<pre class="prettyprint linenums lang-xml">
public class Hello {
	public void sayHello() {
    	System.out.println("Hello");
    }
}
</pre>

Remember

If your code contains any generics or simply put < or > symbols than there might be an error that page won’t be accepted.
You need to replace < and > with &lt; and &ampgt;

In case you need to minify your CSS script

CSS Minifies

No comments:

Post a Comment

Bottom Ad [Post Page]