[WordPress] 外掛分享: Syntax Highlighter MT

首頁外掛目錄 › Syntax Highlighter MT
100+
安裝啟用
尚無評分
3866 天前
最後更新
問題解決
WordPress 2.7.1+ v2.2.5 上架:2009-10-21

內容簡介

這個外掛與其他啟用 Syntax Highlighter 工具使用的外掛類似。現在,Syntax Highlighter 工具的動態外掛程式載入功能可用,因此筆刷配置已過時。

可用的筆刷有:
    applescript
    actionscript3 as3
    bash shell
    coldfusion cf
    cpp c
    c# c-sharp csharp
    css
    delphi pascal
    diff patch pas
    erl erlang
    groovy
    hive
    java
    jfx javafx
    js jscript javascript
    objc obj-c
    perl pl
    php
    pig
    text plain
    py python
    ruby rails ror rb
    sass scss
    scala
    sql
    vb vbnet
    xml xhtml xslt html

更改顯示主題

您可以通過轉到設置->Syntax Highlighter MT來更改顯示主題。 可用的主題如下:

默認
Django
日食
Emacs
FadeToGrey
MDUltra
午夜
RDark

進階用法
更改代碼外觀

有許多內置功能可以應用於控制格式化的代碼的顯示方式。 在創建 Brush 聲明後,這些選項會附加到類定義後面。

自動鏈接

默認情況下啟用此選項。禁用此選項會關閉對在突顯顯示中的鏈接的檢測,使得URL無法點擊。

<pre class="brush: java; auto-links: false">
String link = "http://www.megatome.com";
</pre>

class-name

使用此選項來指定應用於生成的突出顯示元素的一個或多個類。

collapse

默認情況下為假。 強制默認情況下將突出顯示的代碼折疊起來。

first-line

默認為1。更改突出顯示的某部分代碼的起始行號。

<pre class="brush: java; first-line: 20">
String link = "http://www.megatome.com";
</pre>

gutter

默認情況下啟用。 打開和關閉行號。

<pre class="brush: java; gutter: false">
String link = "http://www.megatome.com";
</pre>

highlight

指定要突出顯示的一行或多行。

<pre class="brush: java; highlight: [1, 3]">
String link = "http://www.megatome.com";
System.out.println("Hello World");
System.out.println("Goodbye World");
</pre>

toolbar

默認情況下啟用。是否生成工具欄。

<pre class="brush: java; toolbar: false">
String link = "http://www.megatome.com";
</pre>

title

允許為代碼塊設置標題。 這不是在類中而是在<pre/>或 <script/> 標籤中指定的。

<pre class="brush: java" title="Here is some Java">
String link = "http://www.megatome.com";
</pre>

請參見 http://alexgorbatchev.com/wiki/SyntaxHighlighter以了解有關使用 Syntax Highlighter 工具的文檔。

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.2.5) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Syntax Highlighter MT」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin works like many of the others that enable the use of the Syntax Highlighter tool. Dynamic plugin loading
is now available as part of the Syntax Highlighter tool, making brush configuration obsolete.
Available brushes are:
applescript
actionscript3 as3
bash shell
coldfusion cf
cpp c
c# c-sharp csharp
css
delphi pascal
diff patch pas
erl erlang
groovy
hive
java
jfx javafx
js jscript javascript
objc obj-c
perl pl
php
pig
text plain
py python
ruby rails ror rb
sass scss
scala
sql
vb vbnet
xml xhtml xslt html
Changing display themes
The display theme can be changed by navigating to Settings -> Syntax Highlighter MT. The themes available are:

Default
Django
Eclipse
Emacs
FadeToGrey
MDUltra
Midnight
RDark

Advanced Usage
Changing the appearance of code
There are many options that can be applied inline to control how your formatted code is displayed. These are appended to the class definition after the brush declaration.
auto-links
Enabled by default. Disabling this turns off link detection in the highlighted section, making URLs non-clickable.

String link = "http://www.megatome.com";

class-name
Use this to specify one or more classes that should be applied to the generated highlight element.
collapse
False by default. Forces the highlighted code to be collapsed by default.
first-line
1 by default. Change the starting line number for a section of highlighted code.

String link = "http://www.megatome.com";

gutter
Enabled by default. Turn the line numbers on and off.

String link = "http://www.megatome.com";

highlight
Specify one or more lines to be highlighted.

String link = "http://www.megatome.com";
System.out.println("Hello World");
System.out.println("Goodbye World");

toolbar
Enabled by default. Toggle the toolbar.

String link = "http://www.megatome.com";

title
Allows a title to be set for a block of code. This is not in the class, but in the

 or 

延伸相關外掛

文章
Filter
Apply Filters
Mastodon