Title: Code Markup
Author: bennettmcelwee
Published: <strong>2005 年 5 月 12 日</strong>
Last modified: 2008 年 4 月 14 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/code-markup.svg)

# Code Markup

 作者：[bennettmcelwee](https://profiles.wordpress.org/bennettmcelwee/)

[下载](https://downloads.wordpress.org/plugin/code-markup.1.3.zip)

 * [详情](https://cn.wordpress.org/plugins/code-markup/#description)
 * [评价](https://cn.wordpress.org/plugins/code-markup/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/code-markup/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/code-markup/#developers)

 [支持](https://wordpress.org/support/plugin/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, <em> will be rendered
as emphasised text, but in an HTML code block, <em> will be displayed as <em>.

(I have to use square brackets instead of angle brackets because of the WordPress
Extend site formatting.)

USAGE

 1. Enclose any code inside a <code> block.
 2. Use <code markup=”…” lang=”…”> to specify appearance of code.
 3.  * Include any HTML markup you like in the code, for example to add emphasis to
       certain sections.
     * Separate <code> blocks should be nested within a <pre> block to preserve whitespace.
 4. 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.
 5.  * <code> or <code markup=”default”> allows common HTML tags to be rendered, and
       displays everything else exactly as written.
     * <code lang=”html”> or <code lang=”xhtml”> displays content exactly as written,
       the same as <code markup=”none”>.
 6. The markup attribute overrides the lang attribute.
 7. Separate <code> blocks should be nested within a <pre> block to
     preserve whitespace.

## 安装

 1. Copy code-markup.php into your WordPress plugins directory (wp-content/plugins).
 2. Log in to WordPress Admin. Go to the Plugins page and click Activate for Code Markup.
 3. Go to the Options page and click Writing. Make sure “WordPress should correct invalidly
    nested XHTML automatically” is NOT checked. (Otherwise it may do funny things to
    your code listings.)

## 常见问题

  What is this good for?

The plugin allows you to quickly copy and paste code into your blog, and add HTML
markup to it to emphasise certain parts of it. Normally this is not possible without
a lot of fiddly manual editing.

  what tags are allowed by default?

If the code block has its lang attribute set to html or xhtml, then no tags are 
allowed: all tags are escaped and will display as typed. Otherwise the following
tags are allowed: em strong b i ins del a span

  How do I change the default behaviour?

To make the code block render as straight HTML, set the code block’s “markup” attribute
to “all”. In this case, make sure that you have typed correct HTML!

To make the code block display exactly as typed, set the code block’s “markup” attribute
to “none”.

To allow the default tags to be rendered as HTML, even in HTML code, set the code
block’s “markup” attribute to “default”.

## 评价

此插件暂无评价。

## 贡献者及开发者

「Code Markup」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ bennettmcelwee ](https://profiles.wordpress.org/bennettmcelwee/)

[帮助将「Code Markup」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/code-markup)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/code-markup/)，查看[SVN仓库](https://plugins.svn.wordpress.org/code-markup/)，
或通过[RSS](https://plugins.trac.wordpress.org/log/code-markup/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/code-markup/)。

## 额外信息

 *  版本 **1.3**
 *  最后更新：**18 年前**
 *  活跃安装数量 **200+**
 *  WordPress 版本 ** 1.5 或更高版本 **
 *  已测试的最高版本为 **2.5**
 *  语言
 * [English (US)](https://wordpress.org/plugins/code-markup/)
 * 标签
 * [code](https://cn.wordpress.org/plugins/tags/code/)[format](https://cn.wordpress.org/plugins/tags/format/)
   [java](https://cn.wordpress.org/plugins/tags/java/)[markup](https://cn.wordpress.org/plugins/tags/markup/)
 *  [高级视图](https://cn.wordpress.org/plugins/code-markup/advanced/)

## 评级

尚未提交反馈。

[Your review](https://wordpress.org/support/plugin/code-markup/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/code-markup/reviews/)

## 贡献者

 *   [ bennettmcelwee ](https://profiles.wordpress.org/bennettmcelwee/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/code-markup/)