[WordPress] 外掛分享: Code Markup

首頁外掛目錄 › Code Markup
200+
安裝啟用
尚無評分
6684 天前
最後更新
問題解決
WordPress 1.5+ v1.3 上架:2005-05-11

內容簡介

Code Markup 是一款 WordPress 外掛程式,可讓您輕鬆地在文章中插入程式碼範例。您甚至可以在程式碼範例中包括 HTML 標記;Code Markup 魔法般地知道哪些字元應該顯示為程式碼,哪些應該呈現為 HTML。

該外掛程式透過轉義大部分特殊的 HTML 標籤和字元,讓它們顯示的格式與輸入一致,但留下某些不變的標籤,使它們呈現正常的 HTML。允許的標籤的預設集合是標準的格式標籤,例如 em、strong、span 等等。您可以明確地控制這一點,或者透過指定程式碼區塊的語言,隱式地控制。例如,在正常的程式碼區塊中,<em> 會呈現為強調文本,但在 HTML 程式碼區塊中,<em> 會顯示為 <em>。

(我必須使用方括號代替角括號,因為 WordPress Extend 站點的格式處理方式。)

使用方法

將任何程式碼置於 <code> 區塊中。

使用 <code markup=”…” lang=”…”> 指定程式碼的外觀。

在程式碼中包含任何您喜歡的 HTML 標記,例如為某些部分添加強調。
分開的 <code> 區塊應該嵌套在 <pre> 區塊中,以維持空格。

如果您想要微調 Code Markup 處理您的程式碼的方式,可以在程式碼標記上使用 markup 和 lang 屬性,以指定 Code Markup 應該如何處理它。

<code> 或 <code markup=”default”> 允許常見的 HTML 標籤呈現,並顯示其他所有內容的精確內容。
<code markup=”none”> 顯示內容的內容完全按照輸入的方式顯示-不呈現標記。
<code markup=”all”> 將內容顯示為 HTML-顯示所有標記。
<code markup=”em strong a”> 將 <em>、<strong> 和 <a> 標記視為 HTML 標記-其他所有內容都會以精確的內容顯示。您可以在標記屬性中放置任何您喜歡的標記,用空格分隔。作為一個特殊的例子,您可以包含註釋標記-這意味著 HTML 註釋 <! - 如此 - > 將呈現為正常的 HTML 註釋(即不被顯示)。
<code lang=”html”> 或 <code lang=”xhtml”> 將內容完全按照輸入方式顯示,與 <code markup=”none”> 相同。

標記屬性覆蓋 lang 屬性。

分開的 <code> 區塊應該嵌套在 <pre> 區塊中,以維持空格。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.3) 或搜尋安裝

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

原文外掛簡介

Code Markup is a WordPress plugin that makes it easy to include program code samples in your posts. You can even include HTML markup in the code sample; Code Markup magically knows which characters should be displayed as code and which should be rendered as HTML.
The plugin works by escaping most special HTML tags and characters so they display exactly as typed, but leaving certain ones alone so they will render as normal HTML. The default set of allowed tags is the standard formatting tags like em, strong, span and so on. You can control this explicitly, or implicitly by specifying the language of the code block. For example, in a normal code block, will be rendered as emphasised text, but in an HTML code block, will be displayed as .
(I have to use square brackets instead of angle brackets because of the WordPress Extend site formatting.)
USAGE

Enclose any code inside a block.

Use to specify appearance of code.

Include any HTML markup you like in the code, for example to add emphasis to certain sections.
Separate blocks should be nested within a

 block to preserve whitespace.

If you want to fine-tune how Code Markup treats your code, use the markup and lang attributes on the code tag to specify how Code Markup should handle it.

or allows common HTML tags to be rendered, and displays everything else exactly as written.

or displays content exactly as written, the same as .

The markup attribute overrides the lang attribute.

Separate blocks should be nested within a

 block to
preserve whitespace.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon