четверг, 28 апреля 2016 г.

How to highlight syntax in your blog

First of all, go to higlighter's developer page.

Go to your blog template settings, and choose to edit HTML.
Than paste following code before </head> tag (note, you must supply additional shBrush* files for additional languages):

<link href="http://alexgorbatchev.com/pub/sh/current/styles/shCore.css" rel="stylesheet" type="text/css" />
<link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'></script>
Paste the following code before </body> tag.
<script type='text/javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
</script> 
Save the template. Now use it:
<pre class="brush: html">
...Your html-escaped code goes here...
</pre>
Remember that you have to escape your HTML characters.