Guide/SourceCodeSyntaxHighlight

From YuntechWiki

Jump to: navigation, search

在<code>...</code>之間放置程式碼,頁面顯示程式碼的原始排版,但不會經過著色。

/*************************************************************************
* Compilation: javac HelloWorld.java
* Execution: java HelloWorld
*
* Prints "Hello, World". By tradition, this is everyone's first program.
*
*  % java HelloWorld
* Hello, World
*
*************************************************************************/
 
public class HelloWorld {
 
public static void main(String[] args) {
System.out.println("Hello, World");
}
 
}

在<code 'java'>...</code>之間放置程式碼,頁面顯示程式碼的原始排版,並且經過Java風格的程式碼著色,java可以更換為其他程式語言的名稱,關於已支援的程式語言請參考文末列表或GeSHi網站

/*************************************************************************
* Compilation: javac HelloWorld.java
* Execution: java HelloWorld
*
* Prints "Hello, World". By tradition, this is everyone's first program.
*
*  % java HelloWorld
* Hello, World
*
*************************************************************************/

 
public class HelloWorld {
 
public static void main(String[] args) {
System.out.println("Hello, World");
}
 
}

在<code java n>...</code>之間放置程式碼,除程式碼排版及著色外,還會加上行號,附加的參數n為指定開啟行號顯示功能。

  1. /*************************************************************************
  2.  * Compilation: javac HelloWorld.java
  3.  * Execution: java HelloWorld
  4.  *
  5.  * Prints "Hello, World". By tradition, this is everyone's first program.
  6.  *
  7.  *  % java HelloWorld
  8.  * Hello, World
  9.  *
  10.  *************************************************************************/
  11.  
  12. public class HelloWorld {
  13.  
  14. public static void main(String[] args) {
  15. System.out.println("Hello, World");
  16. }
  17.  
  18. }


List of supported languages for Geshi 1.0.7.20:


.php.php
abap
actionscript
ada
apache
applescript
asm
asp
autoit
bash
blitzbasic
bnf
c
c_mac
caddcl
cadlisp
cfdg
cfm
cpp-qt
cpp
csharp
css-gen
css
d
delphi
diff
div
dos
dot
eiffel
fortran
freebasic
genero
gml
groovy
haskell
html4strict
idl
ini
inno
io
java
java5
javascript
latex
lisp
lua
m68k
matlab
mirc
mpasm
mysql
nsis
objc
ocaml-brief
ocaml
oobas
oracle8
pascal
per
perl
php-brief
php
plsql
python
qbasic
rails
reg
robots
ruby
sas
scheme
sdlbasic
smalltalk
smarty
sql
tcl
text
thinbasic
tsql
vb
vbnet
vhdl
visualfoxpro
winbatch
xml
xpp
z80

Personal tools