WordPress_WP-Syntax插件用法_随手记

这么慢的博客更新速度,代码高亮插件WP-Syntax的用法总是记不住……下面是把插件页的用法粘了过来方便以后用的时候看一眼.

Usage

Wrap code blocks with <pre lang="LANGUAGE" line="1"> and </pre> where"LANGUAGE" is a GeSHi supported language syntax. See below for a full list of supported languages. The line attribute is optional.

Example 1: PHP, no line numbers

<pre lang="php">
<div id="foo">
<?php
  function foo() {
    echo "Hello World!\\n";
  }
?>
</div>
</pre>

Example 2: Java, with line numbers

<pre lang="java" line="1">
public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello World!");
  }
}
</pre>

Example 3: Ruby, with line numbers starting at 18

<pre lang="ruby" line="18">
class Example
  def example(arg1)
    return "Hello: " + arg1.to_s
  end
end
</pre>

Example 4: If your code already has html entities escaped, use escaped="true" as an option

<pre lang="xml" escaped="true">
&lt;xml&gt;Hello&lt;/xml&gt;
</pre>

Example 5: PHP, with line numbers and highlighting a specific line

<pre lang="php" line="1" highlight="3">
<div id="foo">
<?php
  function foo() {
    echo "Hello World!\\n";
  }
?>
</div>
</pre>

Example 6: PHP, with a caption (file and/or file path of the source file)

<pre lang="php" src"https://github.com/shazahm1/Connections/blob/master/connections.php">
<div id="foo">
<?php
  function foo() {
    echo "Hello World!\\n";
  }
?>
</div>
</pre>

Supported Languages

The following languages are most supported in the lang attribute:

abap, actionscript, actionscript3, ada, apache, applescript, apt_sources, asm, asp, autoit, avisynth, bash, bf, bibtex, blitzbasic, bnf, boo, c, c_mac, caddcl, cadlisp, cil, cfdg, cfm, cmake, cobol, cpp-qt, cpp, csharp, css, d, dcs, delphi, diff, div, dos, dot, eiffel, email, erlang, fo, fortran, freebasic, genero, gettext, glsl, gml, bnuplot, groovy, haskell, hq9plus,html4strict, idl, ini, inno, intercal, io, java, java5, javascript, kixtart, klonec, klonecpp, latex, lisp, locobasic, lolcode lotusformulas, lotusscript, lscript, lsl2, lua, m68k, make, matlab, mirc, modula3, mpasm, mxml, mysql, nsis, oberon2, objc, ocaml-brief, ocaml, oobas, oracle11, oracle8, pascal, per, pic16, pixelbender, perl, php-brief, php, plsql, povray, powershell, progress, prolog, properties, providex, python, qbasic, rails, rebol, reg, robots, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, tcl, teraterm, text, thinbasic, tsql, typoscript, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xml, xorg_conf, xpp, z80