[WordPress] 外掛分享: SyHi

首頁外掛目錄 › SyHi
10+
安裝啟用
尚無評分
5624 天前
最後更新
問題解決
WordPress 2.8.5+ v0.0.4 上架:2009-11-01

內容簡介

這個外掛完全是為開發人員而設計的。

你知道,那些經常在部落格發布程式碼片段且很少使用可視化編輯器的人,
因為他們自己撰寫 HTML 代碼,但他們不喜歡 WordPress 改變他們的引號和破折號,
因此這個外掛確保沒有人會動他們精心製作的代碼。

它也非常極簡 - 不到10k,不包括已包含的 GeSHi 語法突出顯示庫。

此外,它也很懶散。它會盡可能避免做太多的工作。
這很好,因為它不會像其他外掛一樣佔用資源。

使用

每當你要發布一些語法突出顯示代碼時,請使用<code lang="語言"></code>將它框起來。就是這樣。

例如:

<code lang="php">
class HelloWorld()
{
public function __construct()
{
echo "這是一個不必要冗長的Hello World版本";
}
}
</code>

“lang”屬性可以完全省略。您將獲得空格、引號和破折號的保存,但沒有突出顯示功能。

卸載

只需停用此外掛,並從“wp-content/plugins”目錄下刪除其資料夾。

致謝

非常感謝 GeSHi 库的創建者。沒有它,此外掛的輸出會非常無聊。
這是它的主頁:http://qbnz.com/highlighter/

以下外掛程式是啟發和指導的寶貴來源:

Preserve Code Formatting,由 Scott Reilly(http://coffee2code.com)
Code Snippet,由Roman Roan製作。 現由Wyatt Neal維護(http://blog.hackerforhire.org/code-snippet/)

您可以說,這個外掛是這兩個外掛的精華之和。

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.0.4) 或搜尋安裝

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

原文外掛簡介

This plug-in is totally designed for developers.
You know, that sort of people who post code snippets in their blog regularly and hardly use the Visual Editor,
because they write the HTML themselves. But they don’t like WordPress messing with their quotes and dashes,
so this plug-in makes sure no one touches one of their lovingly crafted lines of code.
It’s also very minimalistic – less than 10k, not counting the GeSHi syntax highlighting library which is also included.
In addition, it’s also lazy. It will try to avoid doing as much work as possible.
That is good, because it will not eat resources like other plug-ins out there.
Usage
Whenever you want to post some syntax highlighted code, surround it with . That’s it.
Example:

class HelloWorld()
{
public function __construct()
{
echo "This is an unnecessarily long version of Hello World";
}
}

The ‘lang’ attribute can be entirely omitted. You will get whitespace, quotes and dashes preservation… but no highlighting.
Uninstall
Just deactivate the plug-in, and remove its folder from the wp-content/plugins directory.
Thanks
Big thanks to the creators of the GeSHi library. Without it, the output of this plug-in would be very boring.
Here’s its homepage: http://qbnz.com/highlighter/
The following plug-ins were invaluable sources of inspiration and how-to-do-it-right:

Preserve Code Formatting, by Scott Reilly (http://coffee2code.com)
Code Snippet, by Roman Roan. Now maintained by Wyatt Neal (http://blog.hackerforhire.org/code-snippet/)

You could say this plug-in is the sum of the essence of both plug-ins.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon