A few little tricks on how to blog code or any text files for that matter (.txt, .xml, .cs, .cpp, etc.):
You can use the Code Style from the Editor, but that code will just be monofont and handle the spacing, newlines and tabs if you paste it into the non-html editor.
A better way, but sadly incompatible with the non-html editor is to use the following tags (must be done in raw html mode and you should do it when all the rest of the text is written):
<pre class="brush: csharp">
or use
<pre class="brush: xml">
for xml, etc.
When you are done with your code block, just close it with
</pre>
To post images in the upper right corner like I always do, just upload an image, go to html mode and copy it to the very start of the blog post and add style="float:right" to the img tag!
References:
| |
| Bash/shell | bash, shell | |
| C# | c-sharp, csharp | |
| C++ | cpp, c | |
| CSS | css | |
| Delphi | delphi, pas, pascal | |
| Diff | diff, patch | |
| Groovy | groovy | |
| JavaScript | js, jscript, javascript | |
| Java | java | |
| JavaFX | jfx, javafx | |
| Perl | perl, pl | |
| PHP | php | |
| Plain Text | plain, text | |
| PowerShell | ps, powershell | |
| Python | py, python | |
| Ruby | rails, ror, ruby | |
| Scala | scala | |
| SQL | sql | |
| Visual Basic | vb, vbnet | |
| XML | xml, xhtml, xslt, html, xhtml |