Chưa phân loại

[Tip] How to add syntax highlighting to blog


I’m a new blogger on My blog is primarily share my experience about programming.

At the first, I intended to post a entry about “dot dot dot notation in C++”, but I was so surprise because I didn’t know how to highlight my code. And of course, I tried to install a syntax highlighting plugin to do this. But…

After an half-hour researching, I found that this host blogging doesn’t support me to install any plug-in. That was a nightmare.

I had been continuing searching for an half-hour again and fortunately, I found this page:

It say that: “While doesn’t allow you to use potentially dangerous code on your blog, there is a way to post source code for viewing. We have created a shortcode you can wrap around source code that preserves its formatting and even provides syntax highlighting for certain languages, like so:

// Your code

With your_programming_language is any language signature listed bellow.

It’s clearly to understand, let’s take an example now:

// Your C# code
Console.WriteLine("Hello C#");

Awesome, now, let’s take your eyes for all language that you can highlight as bellow:

  • 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

Enjoy and hope that help you  save a lot of time.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s