Title: WP-Markdown-SyntaxHighlighter
Author: mattshelton
Published: <strong>2012 年 9 月 13 日</strong>
Last modified: 2012 年 9 月 17 日

---

搜索插件

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

![](https://s.w.org/plugins/geopattern-icon/wp-markdown-syntaxhighlighter.svg)

# WP-Markdown-SyntaxHighlighter

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

[下载](https://downloads.wordpress.org/plugin/wp-markdown-syntaxhighlighter.0.4.zip)

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

 [支持](https://wordpress.org/support/plugin/wp-markdown-syntaxhighlighter/)

## 描述

WP-Markdown-SyntaxHighlighter is intended to work with the [wp-markdown](https://wordpress.org/extend/plugins/wp-markdown/)
and [SyntaxHighlighter Evolved](http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/)
plugins as follows:

 * WP-Markdown can automatically use [Prettify.js](http://code.google.com/p/google-code-prettify/)
   to format code, but if you prefer [Alex Gorbatchev’s SyntaxHighlighter](http://alexgorbatchev.com/SyntaxHighlighter/),
   this plugin will re-format the Markdown-formatted code blocks to be properly 
   styled by SyntaxHighlighter directly or SyntaxHighlighter Evolved via plugin.
 * SyntaxHighlighter Evolved uses SyntaxHighlighter and additional extended functionality
   to display code blocks in an easily readable manner.

There are two methods of use:

 1. Add a `#!` line to your code example and specify the language (brush) only
 2. Add a `#!!` line to your code example and specify any/all supported parameters 
    via a JSON object

#### Simple Method

To use, add a `#!` line as the first line of your code example with the language
you are using:

    ```
    #!ruby
    class Foo < Bar
      def hello
        puts "Hello World!"
      end
    end
    ```

The `#!` is removed, and the code is reformatted as:

    ```
    <pre class="brush:ruby; notranslate" title="">class One < Two
      def hello
        puts "Hello World!"
      end
    end</pre>
    ```

#### Full Method

To use, add a `#!!` line as the first line of your code example, with any of the
supported SyntaxHighlighter parameters as a JSON object

    ```
    #!!{"brush":"ruby","toolbar":"true","highlight":"[2,3,4]"}
    class Foo < Bar
      def hello
        puts "Hello World!"
      end
    end
    ```

The `#!!` is removed, and the parameters are interpreted into a CSS class string
as:

    ```
    <pre class="brush: ruby; toolbar: true; highlight: [2,3,4]; notranslate">class Foo < Bar
      def hello
        puts "Hello World!"
      end
    end</pre>
    ```

### TODO

 * Consider adding support to toggle ‘notranslate’

## 安装

 1. Upload the `wp-markdown-syntaxhighlighter` folder (and its contents) to the `/wp-
    content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress
 3. Modify improperly formatted code blocks with your chosen `#!` or `#!!` formatting.

## 评价

此插件暂无评价。

## 贡献者及开发者

「WP-Markdown-SyntaxHighlighter」是开源软件。 以下人员对此插件做出了贡献。

贡献者

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

[帮助将「WP-Markdown-SyntaxHighlighter」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/wp-markdown-syntaxhighlighter)

### 对开发感兴趣吗?

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

## 更新日志

#### 0.4

 * Switched from `preg_replace()` to `preg_replace_callback` for ()
 * Removed some potentially harmful formatting code
 * _Hat tip to Richard Cyrus for suggesting these changes_

#### 0.3.1

 * Updated licensing to GPL 2 in order to post in WP plugin directory
 * Cleaned up some comments, code formatting

#### 0.3

 * Fixed case where both syntaxes could not be used in a single post
 * Added support for the title parameter (default: empty)

#### 0.2.1

 * Refactored strings to constants
 * Fixed a typo

#### 0.2

 * Added `#!!` syntax to support extended parameters from JSON string
 * Added support for the following parameters:
    - auto-links (default: true)
    - class-name (default: ”)
    - collapse (default: false)
    - first-line (default: 1)
    - gutter (default: true)
    - highlight (default: null, format is a number or array of numbers)
    - html-script (default: false)
    - ruler (default: false)
    - smart-tabs (default: true)
    - title (default: null) **NOTE**: This does not set the title attribute on the`
      <pre>` tag yet.
    - tab-size (default: 4)
    - toolbar (default: true)

#### 0.1

 * Initial release

## 额外信息

 *  版本 **0.4**
 *  最后更新：**14 年前**
 *  活跃安装数量 **10+**
 *  WordPress 版本 ** 3.1 或更高版本 **
 *  已测试的最高版本为 **3.4.2**
 *  语言
 * [English (US)](https://wordpress.org/plugins/wp-markdown-syntaxhighlighter/)
 * 标签
 * [code](https://cn.wordpress.org/plugins/tags/code/)[markdown](https://cn.wordpress.org/plugins/tags/markdown/)
   [pre](https://cn.wordpress.org/plugins/tags/pre/)[syntax](https://cn.wordpress.org/plugins/tags/syntax/)
   [SyntaxHighlighter](https://cn.wordpress.org/plugins/tags/syntaxhighlighter/)
 *  [高级视图](https://cn.wordpress.org/plugins/wp-markdown-syntaxhighlighter/advanced/)

## 评级

尚未提交反馈。

[Your review](https://wordpress.org/support/plugin/wp-markdown-syntaxhighlighter/reviews/#new-post)

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

## 贡献者

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

## 支持

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

 [查看支持论坛](https://wordpress.org/support/plugin/wp-markdown-syntaxhighlighter/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](http://www.mattshelton.net)