Syntax Highlighter for WordPress code highlighting

After you installed wordpress, the ape as a program to write about things without aproper code highlighting IDE viewer, how to look very awkward. The online investigationhighlighted on the wordpress plug-ins or a lot. Domestic foreign a search in the background. But finally took a fancy to this syntax the highlighter written in Japanese,looked very good, support for 10 languages​​, and css showcase also very good. (JP writesoftware do not have much impression, but it feels very rules).

The methods used are as follows, enter the code [/ language] [Language] to show in thehtml editor. But in the background of wordpress need to note the problem of space, looks like I posted the code all spaces are removed, as a pre tag, it may just not accustomed to use wordpress.

eg:

 my code [/ python] ps,: pay attention to formal you want to delete the spaces, or mismatched on
<pre>[python toolbar="false"]
# -*- coding:utf-8 -*-
__author__ = 'hjcook'

import math

EARTH_RADIUS_METER = 6378137.0
def deg2rad(d):
    """degree to radian"""
    return d*math.pi/180.0
def spherical_distance(f, t):
    """caculate the spherical distance of two points """
    flon = deg2rad(f[0])
    flat = deg2rad(f[1])
    tlon = deg2rad(t[0])
    tlat = deg2rad(t[1])
    con = math.sin(flat)*math.sin(tlat)
    con += math.cos(flat)*math.cos(tlat)*math.cos(flon - tlon)
    return math.acos(con)*EARTH_RADIUS_METER

Where the square brackets can be replaced for other languages, you need to showcode. Other support-related parameters, such as:

the num --- specify the starting line number

highlight_lines --- To highlight row

the gutter ---- whether to display the line number

toolbar ---- whether to display the toolbar

There are a number of other parameters, such as ruler, light, font_size, lang_name.

The supported languages ​​are as follows:

  • as3
  • bash
  • c
  • cpp
  • csharp
  • coldfusion
  • diff
  • erlang
  • groovy
  • java
  • javafx
  • javascript
  • delphi
  • pascal
  • perl
  • php
  • powershell
  • python
  • ruby
  • shell
  • text
  • vb
  • vbnet
  • scala
  • sql
  • css
  • xml
  • html
  • xhtml
  • xslt

本文固定链接: http://www.higis.org/en/2012/04/21/syntax-highlighter-for-wordpress/ | Hi,GIS


该日志由 H.J 于2012年04月21日发表在 WebServer 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: Syntax Highlighter for WordPress code highlighting | Hi,GIS
关键字: ,

Syntax Highlighter for WordPress code highlighting:等您坐沙发呢!

发表评论

快捷键:Ctrl+Enter