The need of displaying Code Snippets in your blog is fulfilled by the Plugin effectively.
The plugin can be used as follows,
Code that you want to have syntax highlighted and displayed in Code Textarea, should be encoded with pre and code tags as discussed in Installation section of the Plugin.
This plugin can be used to display and highlight code of various languages including C, CPP, Java, PHP, Ruby, Markup (HTML) etc.
From your WordPress dashboard
- Visit 'Plugins > Add New'
- Search for 'Syntax Highlighter by Akshay M.'
- Activate 'Syntax Highlighter by Akshay M.' from your Plugins page.
How to Use:
- Write your code in tags like,
<pre class="language-ruby"><code class="language-ruby">
// Sample Code of Ruby
</code></pre>
- Including Line numbers for your code in the codearea,
pre class="language-ruby line-numbers"><code class="language-ruby">
// Sample Code of Ruby
</code></pre>
- Example for using with various languages:
Ruby -
<pre class="language-ruby"><code class="language-ruby"> # Ruby Code </code></pre>
Java -
<pre class="language-java"><code class="language-java"> # Java Code </code></pre>
PHP -
<pre class="language-php"><code class="language-php"> # PHP Code </code></pre>
C -
<pre class="language-c"><code class="language-c"> # C Code </code></pre>
CPP -
<pre class="language-cpp"><code class="language-cpp"> # CPP Code </code></pre>
HTML -
<pre class="language-html"><code class="language-html"> # HTML Code </code></pre>
Markup -
<pre class="language-markup"><code class="language-markup"> # Markup Code </code></pre>