內容簡介
WP-Markdown-SyntaxHighlighter 是與 WP-Markdown 和 SyntaxHighlighter Evolved 外掛一同設計使用的,具體情況如下:
WP-Markdown 可自動使用 Prettify.js 格式化程式碼,但如果您更偏好 Alex Gorbatchev 的 SyntaxHighlighter,這個外掛將重新格式化 Markdown 塊碼使它們可以直接由 SyntaxHighlighter 或 SyntaxHighlighter Evolved 進行正確的樣式設定。
SyntaxHighlighter Evolved 使用 SyntaxHighlighter 以及其他擴展功能來以易讀的方式顯示程式碼塊。
使用方法有兩種:
在您的程式碼例子中添加 #! 行,並僅指定語言 (brush)
在您的程式碼例子中添加 #!! 行,並通過 JSON 對象指定任何/所有支持的參數
簡單方法
要使用,請將 #! 行添加為您正在使用的程式碼範例的第一行,並加上語言:
#!ruby
class Foo < Bar
def hello
puts "Hello World!"
end
end
會移除 #! 標籤,並將程式碼格式化為:
<pre class="brush:ruby; notranslate" title="">class One < Two
def hello
puts "Hello World!"
end
end</pre>
完全方法
要使用,請在您的程式碼範例中添加一行 #!!,並提供支持的 SyntaxHighlighter 參數作為 JSON 對象
#!!{"brush":"ruby","toolbar":"true","highlight":"[2,3,4]"}
class Foo < Bar
def hello
puts "Hello World!"
end
end
會移除 #!! 標籤,並將參數解釋成 CSS class 字串作為:
<pre class="brush: ruby; toolbar: true; highlight: [2,3,4]; notranslate">class Foo < Bar
def hello
puts "Hello World!"
end
end</pre>
待辦事項
考慮添加切換 ‘notranslate’ 的支援
外掛標籤
開發者團隊
原文外掛簡介
WP-Markdown-SyntaxHighlighter is intended to work with the wp-markdown and SyntaxHighlighter Evolved plugins as follows:
WP-Markdown can automatically use Prettify.js to format code, but if you prefer Alex Gorbatchev’s SyntaxHighlighter, this plugin will re-format the Markdown-formatted code blocks to be properly styled by SyntaxHighlighter directly or SyntaxHighlighter Evolved via plugin.
SyntaxHighlighter Evolved uses SyntaxHighlighter and additional extended functionality to display code blocks in an easily readable manner.
There are two methods of use:
Add a #! line to your code example and specify the language (brush) only
Add a #!! line to your code example and specify any/all supported parameters via a JSON object
Simple Method
To use, add a #! line as the first line of your code example with the language you are using:
#!ruby
class Foo < Bar
def hello
puts "Hello World!"
end
end
The #! is removed, and the code is reformatted as:
class One < Two
def hello
puts "Hello World!"
end
end
Full Method
To use, add a #!! line as the first line of your code example, with any of the supported SyntaxHighlighter parameters as a JSON object
#!!{"brush":"ruby","toolbar":"true","highlight":"[2,3,4]"}
class Foo < Bar
def hello
puts "Hello World!"
end
end
The #!! is removed, and the parameters are interpreted into a CSS class string as:
class Foo < Bar
def hello
puts "Hello World!"
end
end
TODO
Consider adding support to toggle ‘notranslate’
