SyntaxHighlighter 사용하기

SyntaxHighlighter 2.x 에서 지원하는 언어는 아래와 같으며 pre 테그의 class 속성에서 brush 의 값을 해당 언어의 Alias 로 지정해주면 사용이 가능하다.

SyntaxHighlighter : syntaxhighlighter_2.0.320

Brush name

Brush aliases

File name

Bash/shell

bash, shell

shBrushBash.js

C#

c-sharp, csharp

shBrushCSharp.js

C++

cpp, c

shBrushCpp.js

CSS

css

shBrushCss.js

Delphi

delphi, pas, pascal

shBrushDelphi.js

Diff

diff, patch

shBrushDiff.js

Groovy

groovy

shBrushGroovy.js

JavaScript

js, jscript, javascript

shBrushJScript.js

Java

java

shBrushJava.js

Perl

perl, pl

shBrushPerl.js

PHP

php

shBrushPhp.js

Plain Text

plain, text

shBrushPlain.js

Python

py, python

shBrushPython.js

Ruby

rails, ror, ruby

shBrushRuby.js

Scala

scala

shBrushScala.js

SQL

sql

shBrushSql.js

Visual Basic

vb, vbnet

shBrushVb.js

XML

xml, xhtml, xslt, html, xhtml

shBrushXml.js

 

추가

ActionScript3

as, actionscript, ActionScript, as3, AS3

shbrushas3.js

MXML

mxml                                    

shbrushmxml.js[각주:1]

 

사용법은 [여기]

SyntaxHighlighter 2.0 supports:

Name

Value

Description

auto-links

true

Allows you to turn detection of links in the highlighted element on and off. If the option is turned off, URLs won't be clickable. Click here for a demo.

class-name

''

Allows you to add a custom class (or multiple classes) to every highlighter element that will be created on the page. Click here for a demo.

collapse

false

Allows you to force highlighted elements on the page to be collapsed by default. Click here for a demo.

first-line

1

Allows you to change the first (starting) line number. Click here for a demo.

font-size

'100%'

Allows you to easily change the font size in the highlighted elements without having to mess around with additional CSS. Click here for a demo.

gutter

true

Allows you to turn gutter with line numbers on and off. Click here for a demo.

highlight

null

Allows you to highlight one or more lines to focus user's attention. When specifying as a parameter, you have to pass an array looking value, like [1, 2, 3] or just an number for a single line.

If you are changing SyntaxHighlighter.defaults['highlight'], you can pass a number or an array of numbers. Click here for a demo.

html-script

false

Allows you to highlight a mixture of HTML/XML code and a script which is very common in web development. Setting this value to true requires that you have shBrushXml.js loaded and that the brush you are using supports this feature. Click here for a demo.

light

false

Allows you to disable toolbar and gutter with a single property. Click here for a demo.

ruler

false

Allows you to show column ruler on top of highlighted elements. Click here for a demo.

smart-tabs

true

Allows you to turn smart tabs feature on and off. Click here for a demo.

tab-size

4

Allows you to adjust tab size. Click here for a demo.

toolbar

true

Toggles toolbar on/off. Click here for a demo.

wrap-lines

true

Allows you to turn line wrapping feature on and off. Click here for a demo.


설정 예)

<PRE class="brush:xml; smart-tabs: true; wrap-lines: true; first-line: 10;">
...
</PRE>


something here...


  1. http://alexgorbatchev.com 에서는 공식적으로 MXML을 지원하지는 않는듯 합니다. Google 검색에서도 mxml 지원 관련된 파일은 찾지 못했습니다. 위에서 링크결어놓은것은 아마 웹서핑중 얻은 파일을 추가했던것 같습니다. shbrushmxml.js 파일은 검색으로 찾을 수 있네요.. 결론은 mxml은 지원되지 않는다 입니다. [본문으로]
신고
트랙백 ( 0 )개 , 댓글 ( 2 ) 개가 달렸습니다.

Commentary

댓글을 달아 주세요.

  1. 멀구기 2010.03.10 15:06 신고  댓글주소  수정/삭제  댓글쓰기

    위에 mxml 파일이 아니고 xml 파일이 링크되어있네요. 혹시 shbrushmxml.js 는 없나요??

Add a Comment

comment에 대한 답변글은 해당 글상자에 있는 "R"(reply)버튼을 클릭하여 작성해 주시기 바랍니다.

티스토리 툴바