1. Go to Blogger Dashboard > Design > Edit HTML.
2. Press CTRL+F to find the code
3. Copy the below code
4. Paste it on top of </head> this code. 5. Preview your template and if everything works fine, then save it. Make the script work You have just added the script to your blog. If you want to highlight code in your post, then you need to use a tag in order to make your Syntax Highlighter work properly. There are two tags and you can use any one on your blog. 1. <pre> tag 2. <script> tag <pre> tag When writing a new post, you need to use <pre> tag in the post.The code of your post needs to go in between <pre class="brush:html"> and </pre> tags, in order to highlight your code properly. See the screenshot below.
If you are posting HTML code, then you have to use 'html' brush in the<pre>
tag.
Similarly, for CSS code use 'css' brush in theYour 'HTML' code goes here
tag. Here is a list of brushes you can use for your blog post.Note for Bloggers There is a small issue withYour 'CSS' code goes here
<pre>
tag. When you post HTML code in blogger post between <pre class="brush:html">
and </pre>
tags directly, you might get an error like this.To get rid of this error, You have to convert raw HTML to escape characters.
- Go to Quick Escape.
- Paste your HTML code into the text box and click on "Convert to escaped characters →" button.
- After conversion, you can use the converted HTML code in between
<pre class="brush: html">
and</pre>
tags. - Now, HTML code will render correctly on your blog.
This is almost same as
<pre>
tag, but the code of your post needs to go in between <script type="syntaxhighlighter" class="brush:html"><![CDATA[
and ]]></script>
tags.If you use
<script>
tag, then you don't have to convert HTML to escape characters. But I suggest you to use <pre>
tag.Themes for your Syntax Highlighter
Syntax Highlighter 2.0 introduced custom CSS themes. This means that by switching out just one CSS file you can completely change the look and feel of the highlighted syntax. A small number of popular color themes are included with Syntax Highlighter and you can easily make your own. Just click the css theme below to see how it looks...
0 comments:
Post a Comment