首页版面好友提醒登录
返回程序设计版 同主题展开

贴代码的同学注意(代码高亮方法)!

badbear大坏熊^_^ 最后修改于2012-03-17 12:47:04
置顶 #2

为便于阅读,如果需要贴较长代码请使用:

"<code>

</code>

"

把代码括起来,可以自动高亮显示代码。e.g.:

<code lang="cpp">

#include <stdio.h>

int main()

{

int a,b;

printf("Welcome to CPlusPlus!\n");

}

</code>

也可指定代码语言:

"<code lang=xxx>

</code>

"    e.g.:

<code lang="awk">

awk '

{

if (NR > 1)

{

print $0;

}

}' file

</code>


附:支持语言列表

ada

applescript

asm

awk

bat

bib

bison

caml

c_comment

changelog

c

clike_vardeclaration

clipper

cobol

conf

cpp

csharp

css

c_string

default

desktop

diff

d

erlang

errors

extreme_comment2

extreme_comment3

extreme_comment4

extreme_comment

fixed-fortran

flex

fortran

function

glsl

haskell

haxe

html

java

javascript

key_string

langdef

latex

ldap

log

logtalk

lsm

lua

m4

makefile

manifest

nohilite

number

outlang

oz

pascal

pc

perl

php

postscript

prolog

properties

python

ruby

scala

script_comment

sh

slang

sml

spec

sql

style

symbols

tcl

texinfo

todo

tsql

url

vbscript

xml

xorg