Putting Code in Blog Comments

To put code in comments, you can use the Syntax Highlighter tags common to WordPress.

your code here

Or for shorthand, you can do this:

your code here

Here is an example:
using System;</code>

namespace FnoSharp.DataMigrator
class Program
static void Main(string[] args)
Console.WriteLine("Hello, World!");

And it looks like this:
using System;

namespace FnoSharp.DataMigrator
    class Program
        static void Main(string[] args)
            Console.WriteLine("Hello, World!");

The language (or lang) parameter controls how the code is syntax highlighted. The following languages are supported:

  • actionscript3
  • bash
  • clojure
  • coldfusion
  • cpp
  • csharp
  • css
  • delphi
  • erlang
  • fsharp
  • diff
  • groovy
  • html
  • javascript
  • java
  • javafx
  • matlab (keywords only)
  • objc
  • perl
  • php
  • text
  • powershell
  • python
  • r
  • ruby
  • scala
  • sql
  • vb
  • xml

If the language parameter is not set, it will default to “text” (no syntax highlighting).

Code in between the source code tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.


  1. Pedicab tours

    Putting Code in Blog Comments | Rhyous

  2. Best Chiropractic In Santa Monica

    Putting Code in Blog Comments | Rhyous

Leave a Reply

How to post code in comments?