Hello, Bedrock Dev here.
Today I'm going to show you guys how to use SyntaxHighlighter on Blogger (Just like me!).
But, what is SyntaxHighlighter?
Simply, it is a code-highlighter for webs (and other). And this is an example of it.
So, let's get started adding this cool stuffs on your blog too.
On the right top of the Template page, you could find Backup / Restore Button.
Click it and save the template file where you can find later.
2. Adding codes to your blog html
Now the real part begins.
Copy these codes to your clipboard.
--- Other Codes ---
<pre class="brush: xml(This could be changed)">
[Your code here]
</pre>
Today I'm going to show you guys how to use SyntaxHighlighter on Blogger (Just like me!).
But, what is SyntaxHighlighter?
Simply, it is a code-highlighter for webs (and other). And this is an example of it.
So, let's get started adding this cool stuffs on your blog too.
1. Backup your blog templates
You can backup your blog templates on your blogger main page.On the right top of the Template page, you could find Backup / Restore Button.
Click it and save the template file where you can find later.
2. Adding codes to your blog html
Now the real part begins.
Copy these codes to your clipboard.
And then, go back to the Template page, and click Edit HTML Button.
In your blog's template html, there will be </head> tag.
Scroll down and find the tag, and paste the code you copied.
--- Other Codes ---
[Paste the code here]
</head>
You should paste the code like this.
Then, save your template.
3. Using SyntaxHighlighter in your posts
If you want to use SyntaxHighlighter in your post, go to post writing page.
And you can find "HTML" tab in upper left corner (next to "Compose" tab).
In HTML editing tab, you should add this code for SyntaxHighlighter.
--- Other Codes ---
<pre class="brush: xml(This could be changed)">
[Your code here]
</pre>
or,
--- Other Codes ---
<script class="syntaxhighlight brush: xml(This should be changed too)" type="syntaxhighlighter"><![CDATA[
[Your code here]
]]></script>
So what is the difference between them?
I will show you examples.
If you put the first code in HTML;
<pre class="brush :xml">
<this
is="An"
xml="example"/>
</pre>
<script class="syntaxhighlight brush: xml" type="syntaxhighlighter"><![CDATA[
<this
is="An"
xml="example"/>
]]></script>
This is the result.
Both codes was same. And its results are different! Why is it?
Have you notice the difference?
Second code, using the <pre> tag makes no line breaks. It's the difference.
So, this is the end of this tutorial, and visit SyntaxHighlighter's developer homepage.
Enjoy, Bedrock.
--- Other Codes ---
<script class="syntaxhighlight brush: xml(This should be changed too)" type="syntaxhighlighter"><![CDATA[
[Your code here]
]]></script>
So what is the difference between them?
I will show you examples.
If you put the first code in HTML;
<pre class="brush :xml">
<this
is="An"
xml="example"/>
</pre>
This is the result. But if you put the second code;
<script class="syntaxhighlight brush: xml" type="syntaxhighlighter"><![CDATA[
<this
is="An"
xml="example"/>
]]></script>
This is the result.
Both codes was same. And its results are different! Why is it?
Have you notice the difference?
Second code, using the <pre> tag makes no line breaks. It's the difference.
So, this is the end of this tutorial, and visit SyntaxHighlighter's developer homepage.
Enjoy, Bedrock.