This post is about how can we use Google Code Prettify to highlight the code which is displayed in my blog. Google Code Prettify is a simple lightweight embeddable java script library. Find the steps below for how to use Google Code Prettify.
Step 1: Add run_prettify.js script and any one of skin styles(sunburt
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?autoload=true&skin=sunburst&lang=css" defer=""></script>
Step 2: Use pre tag for representing our code as follows. The following is the example of html code highlighter.
<pre class="prettyprint lang-html linenums"> list of statements </pre>
List of Skin Styles
List of built-in languages supported
bsh, c, cc, cpp, cs, csh, cyc, cv, htm, html, java, js, m, mxml, perl, pl, pm, py, rb, sh, xhtml, xml and xsl
List of additional language supported
Apollo,
Basic,
Clojure,
CSS,
Dart,
Erlang,
Go,
Haskell,
Lasso,
Lisp, Scheme,
LLVM,
Logtal,
Lua,
MATLAB,
MLs: F#, Ocaml,SML,
Mumps,
Nemerle,
Pascal,
Protocol buffers,
R, S,
RD,
Rust,
Scala,
SQL,
Swift,
TCL,
LaTeX,
Visual Basic,
VHDL,
Wiki,
XQ,
YAML
For Reference: https://github.com/google/code-prettify
For Reference: https://github.com/google/code-prettify
Comments
Post a Comment