Code Formatting and Highlighting
As well as the formating styles for the texts in the posts, there is also help for formatting code in the posts. Using the <code > </code> tags enables code to be published within posts without having to worry about escaping characters such as < and > with < and > respectively.
The <code > tag also provide syntax highlighting for different programming languages by including the language parameter e.g. <code language=”ruby”></code>
Examples:
PHP - <code language=”php”>...</code>:
echo $hello;
Java - <code language=”java”>...</code>:
System.out.println(hello);
C++ - <code language=”C++”>...</code>:
cout << hello;
Ruby - <code language=”ruby”>...</code>:
puts hello
ATARI BASIC - <code>...</code>:
5 DIM N$(16)
10 LET N$="Hello World"
20 PRINT N$
PHP can also be inserted without the need for a <code> block as long as the <?php ?> tags are included, like so:
<?php
$hello = "Hello World";
echo $hello;
?>