內容簡介
使用 PrismJs 的語法突出顯示器。
使用方法
按照下面所示的方式包裝您的 pre 標籤:
[sh_prismjs_pre class="language-py line-numbers match-braces rainbow-braces" data_line="1,4-5,7" escape_html='escape']
<pre>
class Implements_Ne:
''' A class which implements
the __ne__ method '''
def __ne__( self, other):
return False
class Not_Implements_Ne:
''' A class which does not
implement the __ne__
method '''
pass
</pre>
[/sh_prismjs_pre]
將“NAME”替換為您要突出顯示的語言的名稱。例如,如果語言是 Python ,則 language-NAME 應替換為 language-py 。
如果您希望顯示行號,請使用 line-numbers 。
如果您希望選中時匹配括號,請使用 match-braces 。
如果您希望使用彩虹括號,請使用 rainbow-braces 。
如果您希望突出顯示行,可以使用 data_line 。在提供的示例中,著色第1行,著色第4到5行,著色第7行。
如果您希望 pre 的內容被轉義,因此例如,如果它包含不希望渲染的 html 標籤,您可以使用 escape_html='escape'
對於 code 標籤,它們也應按如下方式包裝:
[sh_prismjs_code class="language-html" escape_html='escape']<code>tag: <br/></code>[/sh_prismjs_code]
您必須使用 language-Name 選項,並且可以使用 escape_html 選項。
外掛標籤
開發者團隊
② 後台搜尋「Syntax Highlighter with PrismJS」→ 直接安裝(推薦)
原文外掛簡介
A syntax highlighter using PrismJs.
How To Use
Wrap your pre tag as shown below:
[sh_prismjs_pre class="language-py line-numbers match-braces rainbow-braces" data_line="1,4-5,7" escape_html='escape']
class Implements_Ne:
''' A class which implements
the __ne__ method '''
def __ne__( self, other):
return False
class Not_Implements_Ne:
''' A class which does not
implement the __ne__
method '''
pass
[/sh_prismjs_pre]
Replace name in language-NAME, by the name of the language that you wish to highlight. For example if the language is python, language-NAME should become language-py .
If you wish line numbers to appear, use line-numbers .
If you wish braces to be matched when selected use match-braces .
If you wish to have rainbow braces use rainbow-braces .
If you wish to highlight lines, you can use data_line, so in the example provided, colorize line 1, and colorize lines from 4 to 5, and colorize line 7.
If you wish the content of the pre to be escaped, so for example if it contains html tags that you do not wish to be rendered, you can use escape_html=’escape’
For code tags, they also should be wrapped as follows:
[sh_prismjs_code class="language-html" escape_html='escape']tag: [/sh_prismjs_code]
You must use the language-Name option, and you can use the escape_html option.
