前言介紹
- 這款 WordPress 外掛「WP-Syntax」是 2007-01-20 上架。
- 目前有 3000 個安裝啟用數。
- 上一次更新是 2023-12-01,距離現在已有 519 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 4.7 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 5.6.20 以上。
- 有 15 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
code | syntax | Highlight | formatting | syntax highlighting |
內容簡介
WP-Syntax 提供乾淨的語法突顯,使用 GeSHi,支援多種流行的語言,包括有或沒有行號的語法突顯,可以在從瀏覽器中複製程式碼片段時保持格式。
它通過運行早期的前置過濾器和後期的後置過濾器來避免與其他第三方外掛程序的衝突,先替換和提取代碼片段,然後在最後推回並加上突顯。結果是源代碼的格式和突顯方式都和預期的一樣。
使用、支援的語言、樣式指南和版本信息都可以在「其他說明」部分中獲得。
想貢獻?WP-Syntax 可以在 GitHub 上找到,現在就派生並提交拉取請求吧!
基本用法
將代碼區塊用
和
包裹起來,其中 LANGUAGE 為 GeSHi 支持的語言語法。line 屬性是可選的。欲知更多用法範例,請參閱其他說明。
用法
將代碼區塊用
和
包裹起來,其中 LANGUAGE 為 GeSHi 支持的語言語法。下面是支援的語言列表。line 屬性是可選的。
範例 1: PHP,無行號
function foo() {
echo "Hello World!\\n";
}
?>
範例 2: Java,行號
public class Hello {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
範例 3: Ruby,從第 18 行開始顯示行號
class Example
def example(arg1)
return "Hello: " + arg1.to_s
end
end
範例 4: 如果你的代碼已經轉義了 HTML 實體,請使用 escaped="true" 作為選項
<xml>Hello</xml>
範例 5: PHP,帶行號和突顯特定行
function foo() {
echo "Hello World!\\n";
}
?>
範例 6: PHP,帶標題(源文件或源文件的文件路徑)
function foo() {
echo "Hello World!\\n";
}
?>
支援的語言
以下是 lang 屬性中支援的主要語言列表:
abap、actionscript、actionscript3、ada、apache、applescript、apt_sources、asm、asp、autoit、avisynth、bash、bf、bibtex、blitzbasic、bnf、boo、c、c_mac、ca...
原文外掛簡介
WP-Syntax provides clean syntax highlighting using
GeSHi — supporting a wide range of popular
languages. It supports highlighting with or without line numbers and maintains formatting while copying snippets of code
from the browser.
It avoids conflicts with other 3rd party plugins by running an early
pre-filter and a late post-filter that substitutes and pulls the code snippets
out first and then pushes them back in with highlighting at the end. The
result is source code formatted and highlighted the way you intended.
Usage, Supported Languages, Styling Guidelines, and Release Notes are available
in the Other Notes section.
Want to contribute? WP-Syntax can be found on GitHub. Fork and submit your pull requests today!
Basic Usage
Wrap code blocks with
and
where “LANGUAGE”
is a GeSHi supported language syntax.
The line attribute is optional. More usage examples
Usage
Wrap code blocks with
and
where “LANGUAGE” is a GeSHi supported
language syntax. See below for a full list of supported languages.
The line attribute is optional.
Example 1: PHP, no line numbers
Example 2: Java, with line numbers
public class Hello {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
Example 3: Ruby, with line numbers starting at 18
class Example
def example(arg1)
return "Hello: " + arg1.to_s
end
end
Example 4: If your code already has html entities escaped, use escaped="true" as an option
Hello
Example 5: PHP, with line numbers and highlighting a specific line
Example 6: PHP, with a caption (file and/or file path of the source file)
Supported Languages
The following languages are most supported in the lang attribute:
abap, actionscript, actionscript3, ada, apache, applescript, apt_sources, asm,
asp, autoit, avisynth, bash, bf, bibtex, blitzbasic, bnf, boo, c,
c_mac, caddcl, cadlisp, cil, cfdg, cfm, cmake, cobol, cpp-qt, cpp,
csharp, css, d, dcs, delphi, diff, div, dos, dot, eiffel, email, erlang,
fo, fortran, freebasic, genero, gettext, glsl, gml, bnuplot, groovy, haskell,
hq9plus, html4strict, idl, ini, inno, intercal, io, java, java5,
javascript, kixtart, klonec, klonecpp, latex, lisp, locobasic, lolcode
lotusformulas, lotusscript, lscript, lsl2, lua, m68k, make, matlab, mirc,
modula3, mpasm, mxml, mysql, nsis, oberon2, objc, ocaml-brief, ocaml,
oobas, oracle11, oracle8, pascal, per, pic16, pixelbender, perl,
php-brief, php, plsql, povray, powershell, progress, prolog, properties,
providex, python, qbasic, rails, rebol, reg, robots, ruby, sas,
scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, tcl, teraterm,
text, thinbasic, tsql, typoscript, vb, vbnet, verilog, vhdl, vim,
visualfoxpro, visualprolog, whitespace, whois, winbatch, xml, xorg_conf,
xpp, z80
See the GeSHi Documentation
for a full list of supported languages.
(Bold languages just highlight the more popular ones.)
Styling Guidelines
WP-Syntax colors code using the default GeSHi colors. It also uses inline
styling to make sure that code highlights still work in RSS feeds. It uses a
default wp-syntax.css stylesheet for basic layout. To customize your styling,
copy the default wp-content/plugins/wp-syntax/wp-syntax.css to your theme’s
template directory and modify it. If a file named wp-syntax.css exists in
your theme’s template directory, this stylesheet is used instead of the default.
This allows theme authors to add their own customizations as they see fit.
Advanced Customization
WP-Syntax supports a wp_syntax_init_geshi action hook to customize GeSHi
initialization settings. Blog owners can handle the hook in a hand-made plugin
or somewhere else like this:
set_brackets_style('color: #000;');
$geshi->set_keyword_group_style(1, 'color: #22f;');
}
?>
This allows for a great possibility of different customizations. Be sure to
review the GeSHi Documentation.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「WP-Syntax」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1.0 | 1.1 | 1.2 | 0.5.1 | 0.5.2 | 0.5.3 | 0.5.4 | 0.6.1 | 0.9.1 | 0.9.2 | 0.9.3 | 0.9.4 | 0.9.5 | 0.9.6 | 0.9.7 | 0.9.8 | 0.9.9 | trunk | 0.9.10 | 0.9.11 | 0.9.12 | 0.9.13 |
延伸相關外掛(你可能也想知道)
String locator 》當你在開發主題和外掛時,你經常會注意到某些文字被硬編碼在文件中,你需要對其進行修改,但你不知道該主題或外掛的名稱,更不知道要查找哪個文件。, 你可以...。
Highlight Search Terms 》這款WordPress外掛能夠在搜索結果頁面上和每個與搜索結果相關聯的文章頁面上突出顯示搜索詞。該外掛輕量且沒有任何選項。它起初是與Thaya Kareeson的《如何使...。
Prismatic 》唯一的 3 合 1 語法高亮插件!, 使用 Prism.js、Highlight.js 或純文字轉義顯示美麗的程式碼片段:, , Prism.js – 使用 Prism.js 轉義和語法高亮, Highlight....。
Highlight and Share – Social Text and Image Sharing 》在您的內容中與您的讀者見面。, 當用戶與您的文字互動時,顯示社交網絡選項(了解 Highlight and Share 如何工作)。, Highlight and Share 具有以下主要功能...。
Custom Highlight Color 》許多裝置和瀏覽器在選擇網站上的文字時提供不太理想的顏色。使用者可能出於習慣閱讀,或是想分享引言等各種原因選擇文字。此外掛可讓您在自訂檢視器中進行即...。
CodeColorer 》CodeColorer 是一個外掛程式,它可以讓您在文章中插入代碼片段並添加漂亮的語法高亮效果。, 此外掛程式基於 GeSHi庫建立,支援大多數語言。CodeColorer 的各...。
Code Prettify 》此外掛為自定版的Code Prettify library,支援本地樣式和腳本。此外掛會自動為頁面上的所有
標籤應用代碼高亮。, 支援古騰堡,且不會將您鎖定在特...。
Tooltipy (tooltips for WP) 》, 此外掛可讓你自動建立適應性工具提示方塊,以解釋專有名詞,讓使用者更舒適地瀏覽網站。, 使用簡碼詞彙表 [kttg_glossary]。, , , 展示, , 實際展示, 管理...。
Text Selection Color 》Text Selection Color 外掛可幫助輕鬆更改網站中已選取文字的顏色。, 功能:, , 使用者可透過外掛設定頁面中的顏色選擇器變更文字顏色和文字背景顏色。, 變更...。
Just Highlight 》Just Highlight 是一個 WordPress 外掛,可用於在文章或頁面中突顯文字,讓您輕鬆創建突顯閱讀者真正關心的內容的美觀文章。, 如何使用?, * 使用游標選擇...。
Featured Post with thumbnail 》這個外掛可以讓你在網誌的側邊欄中的任何地方添加一個區域,專門用於突出顯示你想要強調呈現的文章。它的使用非常簡單:安裝和啟用後,你可以決定將哪些文章...。
WP-GeSHi-Highlight — rock-solid syntax highlighting for 259 languages 》• 現場示範, • 亮點:, , 支援259種程式語言。, 適用於行動裝置:無需執行JavaScript,與基於JavaScript的解決方案相比可節省頻寬和電力。, 後端負載接近零。...。
Mark New Posts 》突顯 WordPress 文章的未讀狀態。, 功能:, , 開箱即用, 提供四種不同的標記方式突顯文章:, , 文字標籤(新!), 橘色圓圈, 圖片, 旗幟圖示, , , 可選擇當何...。
WP SyntaxHighlighter 》這個外掛是一個基於Alex Gorbatchev的SyntaxHighlighter ver. 3.0.83和2.1.382的程式碼語法加亮工具。, 功能特點, , 基於Alex Gorbatchev的"SyntaxHighl...。
Highlight Author Comments 》Highlight Author Comments 外掛能讓文章作者的評論以獨特的樣式顯示,無需編輯模板檔案等步驟。您只需要提供少量 CSS 樣式片段即可應用到作者評論上。, 版本...。