前言介紹
- 這款 WordPress 外掛「WP-GeSHi-Highlight — rock-solid syntax highlighting for 259 languages」是 2010-11-21 上架。
- 目前有 500 個安裝啟用數。
- 上一次更新是 2023-04-30,距離現在已有 734 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 3.0 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 5.6 以上。
- 有 9 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
jgehrcke |
外掛標籤
code | geshi | syntax | Highlight | highlighting |
內容簡介
• 現場示範
• 亮點:
支援259種程式語言。
適用於行動裝置:無需執行JavaScript,與基於JavaScript的解決方案相比可節省頻寬和電力。
後端負載接近零。使用快取解決方案後,將不會影響網頁載入時間。
行數編號。如果需要(程式行與行號之間不會有垂直位移)。
預設樣式經過多達20款主題的測試,包括Twenty Ten到Fifteen款,也根據眾多使用者的回饋進行調整。
如果需要調整樣式:僅需提供自己的CSS檔案,樣式可高度且容易地配置。
區塊樣式:在單一頁面上,每個程式碼區塊都可以自行設定樣式(如果您需要這樣做)。
乾淨、小型和有效的HTML輸出。
使用現代WordPress API呼叫進行全面記錄的源代碼。
我已經維護這個外掛數年了,並且我打算繼續提供支援。
基於GeSHi,一個可靠且良好建立的PHP語法突顯引擎,被流行的社區論壇應用程序(如phpBB)或Wiki應用程序(如Dokuwiki或MediaWiki)使用。
WP-GeSHi-Highlight可作為WP-Syntax的即插即用替代品,後者自2015年以來似乎已不再維護。進行替換,這應該是有效的(讓我知道結果如何)!
• 用法:
WordPress 5使用者:目前我只在傳統編輯器中測試過此外掛程式。Gutenberg目前尚未支援(不過可能可以運作,讓我知道)。
建議:使用“文本”(原始)編輯器,而不是使用“可視化”編輯器。在兩種編輯器之間切換可能會損壞程式碼塊的內容。
在文本編輯器中插入程式碼區塊,並使用lang參數定義程式碼片段的語言:
CODE
以下是bash語言的簡短範例:
$ dd if=/dev/zero of=image.ext3 bs=1M count=10000 oflag=append conv=notrunc
發佈/預覽,並查看結果!
還可以查看所有可用選項的參考文檔。您可以在外掛程式的網站上找到它。請注意,更多的用法示例可以在示範網站上找到。
• 問題:
許多網站已經使用這個外掛程式數年了,似乎已能很好地發揮其作用。如果您發現任何問題,請告訴我:發送郵件或留下評論。
• 預設樣式表的主題相容性:
預設樣式表已經與所有官方主題(包括Twenty Ten到Twenty Fifteen款)和許多非官方主題進行過測試,例如Vantage、Customizr、ColorWay、Zerif Lite、Responsive、Storefront、Virtue、evolve、Make、Sparkling、Spacious、Enigma、Sydney、Point、Interface、SinglePage等等。
原文外掛簡介
• Live demo
• Highlights:
Supports 259 languages.
Server-side. Saves bandwidth, latency, and battery compared to client-side rendering.
Near-zero load on the backend. With a caching solution this does not affect your page load time at all.
Line numbering. If you want to (no vertical displacements between code line and line number).
Default style was tested with more than 20 themes, including Twenty Ten to Fifteen, and tweaked based on a bunch of user feedback.
If you’d like to tweak the style: just provide your own CSS file. Styles are highly & easily configurable.
Per-block styles: each code block on a single page can be styled on its own (if that is something you would liked to do).
Clean, small and valid HTML output.
Well-documented source code using modern WordPress API calls.
I have maintained this plugin for several years and I plan to continue to provide support.
Based on GeSHi, a reliable and well-established PHP highlighting engine, used by popular community forum applications such as phpBB or wiki applications such as Dokuwiki or MediaWiki.
WP-GeSHi-Highlight works as a drop-in replacement for WP-Syntax, which does not seem to be maintained anymore (as of 2015). Make the switch, it should just work (let me know how it went)!
• Usage:
WordPress 5 users: for now I have tested this plugin only with the Classical Editor. Gutenberg is not yet supported (it may work though, let me know).
Recommendation: use the “Text” (raw) editor. Do not use the “Visual” editor. Switching between both may corrupt the contents of your code blocks.
In the text editor insert code blocks as pre blocks, and use the lang argument to define the language of the code snippet:
CODE
A short example for the bash language:
$ dd if=/dev/zero of=image.ext3 bs=1M count=10000 oflag=append conv=notrunc
Publish/preview, and have a look at the result!
Also check out the reference documentation for all available options. You can find it on the plugin’s website. Note that more usage examples can be found on the demo website.
• Issues:
A bunch of websites have used this plugin for years, and it seems to serve its purpose well. If you find an issue please let me know: drop a mail or leave a comment.
• Theme compatibility of the default style sheet:
The default style sheet was tested with recent versions of all official themes (Twenty Ten to Twenty Fifteen), and with a large range of non-official themes such as Vantage, Customizr, ColorWay, Zerif Lite, Responsive, Storefront, Virtue, evolve, Make, Sparkling, Spacious, Enigma, Sydney, Point, Interface, SinglePage.
Certain themes might define styles with a high specificity that negatively affect the visual code block appearance. It is difficult to impossible to anticipate all these cases in advance, so I expect this to happen in rare cases (the past has proven that these things happen). So, I need you to look out for these situations, and please report them!
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「WP-GeSHi-Highlight — rock-solid syntax highlighting for 259 languages」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.0.2 | 1.0.3 | 1.0.4 | 1.0.5 | 1.0.6 | 1.0.7 | 1.0.8 | 1.1.0 | 1.2.0 | 1.2.1 | 1.2.2 | 1.2.3 | 1.2.4 | 1.3.0 | 1.3.1 | 1.3.2 | 1.3.3 | 1.3.4 | 1.4.0 | 1.4.1 | 1.4.2 | 1.4.3 | trunk | 1.0.8.1 | 1.1.0.1 | 1.1.0.2 | 1.0.1-beta |
延伸相關外掛(你可能也想知道)
String locator 》當你在開發主題和外掛時,你經常會注意到某些文字被硬編碼在文件中,你需要對其進行修改,但你不知道該主題或外掛的名稱,更不知道要查找哪個文件。, 你可以...。
Highlighting Code Block 》「Highlighting Code Block」外掛可讓你以一個點擊的方式添加一個有語法突顯的程式碼區塊。, 它支援「區塊編輯器」和「傳統編輯器」。, (不過,我們建議在「...。
Crayon Syntax Highlighter 》一款支援自訂語言和佈景主題的 PHP 和 jQuery 語法突顯外掛。, 它可以從 URL 或 WordPress 文章的文字中進行突顯。Crayon 讓管理語言檔案和使用正則表達式定...。
Code Block Pro – Beautiful Syntax Highlighting 》展示你美麗的程式碼,不僅僅是顯示它!這個版塊外掛提供編輯程式碼塊的功能,直接運行你的程式碼,使用與受歡迎的 VS Code 編輯器相同的渲染引擎。此外掛提供...。
WP-Syntax 》WP-Syntax 提供乾淨的語法突顯,使用 GeSHi,支援多種流行的語言,包括有或沒有行號的語法突顯,可以在從瀏覽器中複製程式碼片段時保持格式。, 它通過運行早...。
Urvanov Syntax Highlighter 》guage files, and there are many available on the plugin's website. The Urvanov Syntax Highlighter block is recommended for new posts instead of the...。
Prismatic 》唯一的 3 合 1 語法高亮插件!, 使用 Prism.js、Highlight.js 或純文字轉義顯示美麗的程式碼片段:, , Prism.js – 使用 Prism.js 轉義和語法高亮, Highlight....。
CodeColorer 》CodeColorer 是一個外掛程式,它可以讓您在文章中插入代碼片段並添加漂亮的語法高亮效果。, 此外掛程式基於 GeSHi庫建立,支援大多數語言。CodeColorer 的各...。
Code Click to Copy 》這是一個簡單的外掛程式,當點擊
和
標籤內容時,會自動複製到剪貼簿中。其他的外掛也有提供相同的功能,但需要點擊 [COPY] 按鈕進...。
Pastacode 》使用 Pastacode,您可以輕鬆地將代碼加入您的文章中,並使用宏偉的 PrismJs 着色庫。, 您可以將源代碼插入到文章編輯器中,直接將其寫入編輯器中(使用 Guten...。
Simple Code Highlighter 》簡易程式碼高亮外掛, 程式碼高亮外掛使用 Google Code Prettify Script 來標示您的程式碼。您不需要程式設計技能來使用它。只需按下編輯器工具列上的按鈕並貼...。
WP SyntaxHighlighter 》這個外掛是一個基於Alex Gorbatchev的SyntaxHighlighter ver. 3.0.83和2.1.382的程式碼語法加亮工具。, 功能特點, , 基於Alex Gorbatchev的"SyntaxHighl...。
Better File Editor 》增加了行號、語法高亮、代碼折疊等功能,並且在 WordPress 的管理面板中的佈景主題和外掛程式編輯器中提供更多功能。, 此外掛程式使用 Ajax.org Cloud9 Edito...。
WP-SynHighlight 》此外掛提供在貼文和評論中的語法突顯功能。, , , 完整的 GUI 模式。不需要像其他外掛一樣在編輯器中切換到程式碼模式再切回來。, 具備即時語法突顯支援的 GUI...。
Google Syntax Highlighter for WordPress 》這個外掛可以輕鬆地將 Google Syntax Highlighter 由 Alex Gorbatchev 整合至 WordPress。, 功能概要, , 100% 客戶端操作,不需依賴於伺服器, 支援多種語言, ...。