Title: PrettyCode • Code syntax highlighting with CodeMirror
Author: maximebj
Published: <strong>2022 年 3 月 8 日</strong>
Last modified: 2026 年 4 月 13 日

---

搜索插件

![](https://ps.w.org/prettycode/assets/banner-772x250.png?rev=2690647)

![](https://ps.w.org/prettycode/assets/icon-256x256.png?rev=2690647)

# PrettyCode • Code syntax highlighting with CodeMirror

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

[下载](https://downloads.wordpress.org/plugin/prettycode.2.0.2.zip)

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

 [支持](https://wordpress.org/support/plugin/prettycode/)

## 描述

The prettiest syntax highlighting block for the WordPress editor.
 Live edit your
code snippets in the admin with bracket matching, customize colors with more thant
50 themes (Base16, Monokai, Material, Zenburn, Hopscotch…). Compatible with major
languages: HTML, CSS, JS, JSX, Stylus, Sass, PHP, Python, C, C++, C#, Java, XML,
Shell, JSON, Go, Swift…

This block uses CodeMirror. You may have seen this block before on the Advanced 
Gutenberg Blocks plugins few years ago. It’s now an updated and standalone block.

### Third Party

This plugins uses some third party libraries:

 * WordPress create-block by gziolo – https://www.npmjs.com/package/@wordpress/create-
   block
 * CodeMirror – https://github.com/codemirror/CodeMirror
 * react-codemirror2 by scniro – https://github.com/scniro/react-codemirror2

A big thanks to their respective creators and maintainers!

## 屏幕截图

[[

[[

## 区块

该插件提供了 1 个区块.

 *   PrettyCode A code syntax highlighting block for your snippets of all major 
   languages.

## 安装

 1. Upload the plugin files to the `/wp-content/plugins/prettycode` directory, or install
    the plugin through the WordPress plugins screen directly.
 2. Activate the plugin through the ‘Plugins’ screen in WordPress
 3. Go to a post and click on ‘Add block’
 4. Search for ‘PrettyCode’

## 常见问题

### Which languages are available?

All major language are available: HTML, CSS, JS, JSX, Stylus, Sass, PHP, Python,
C, C++, C#, Java, XML, Shell, JSON, Go, Swift…

### Can I add more languages ?

Yes, by using the filter `prettycode_languages_list`.

### Can I customize the appearance?

Sure! You have access to 50+ dark and light themes like Base16, Monokai, Material,
Zenburn, Hopscotch…

### Can I contribute?

Yep! The public repository is right here: https://github.com/maximebj/prettycode.
plugin

## 评价

![](https://secure.gravatar.com/avatar/0a8bc6cca8c45cc7c0b42f4526aed0a0eb0dfafb7332f0f83c0cf2899cdd0625?
s=60&d=retro&r=g)

### 󠀁[Parfait](https://wordpress.org/support/topic/parfait-335/)󠁿

 [Guillaume TURPIN](https://profiles.wordpress.org/guillaumeturpin/) 2022 年 3 月
8 日

Merci d’avoir transposé le bloc en standalone, il était vraiment cool dans AGB.

![](https://secure.gravatar.com/avatar/168e9c9d51f35eb9e61d14ccdc76fe23b36d30abb1cff7606a12302554b5b585?
s=60&d=retro&r=g)

### 󠀁[Code is poetry](https://wordpress.org/support/topic/code-is-poetry-5/)󠁿

 [Benjamin Denis](https://profiles.wordpress.org/rainbowgeek/) 2022 年 3 月 8 日

Really useful, I love it!

 [ 阅读所有2条评价 ](https://wordpress.org/support/plugin/prettycode/reviews/)

## 贡献者及开发者

「PrettyCode • Code syntax highlighting with CodeMirror」是开源软件。 以下人员对
此插件做出了贡献。

贡献者

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

「PrettyCode • Code syntax highlighting with CodeMirror」插件已被翻译至 1 种本地
化语言。 感谢[所有译者](https://translate.wordpress.org/projects/wp-plugins/prettycode/contributors)
为本插件所做的贡献。

[帮助将「PrettyCode • Code syntax highlighting with CodeMirror」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/prettycode)

### 对开发感兴趣吗?

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

## 更新日志

#### 2.0.2

 * Fixed build

#### 2.0.1

 * Fixed build

#### 2.0

 * Upgraded to CodeMirror 6
 * Updated blockAPI version to 3
 * Fixed bugs

#### 1.0.7

 * Fixed code editor line height

#### 1.0.6

 * Added translation for JS files
 * Fixed a bug with PHP block

#### 1.0

 * Initial release

## 额外信息

 *  版本 **2.0.2**
 *  最后更新：**2 月前**
 *  活跃安装数量 **100+**
 *  WordPress 版本 ** 5.8 或更高版本 **
 *  已测试的最高版本为 **6.9.4**
 *  PHP 版本 ** 7.0 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/prettycode/) 和 [French (France)](https://fr.wordpress.org/plugins/prettycode/).
 *  [翻译成简体中文](https://translate.wordpress.org/projects/wp-plugins/prettycode)
 * 标签
 * [block](https://cn.wordpress.org/plugins/tags/block/)
 *  [高级视图](https://cn.wordpress.org/plugins/prettycode/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  2 条 5 星评价     ](https://wordpress.org/support/plugin/prettycode/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/prettycode/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/prettycode/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/prettycode/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/prettycode/reviews/?filter=1)

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

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

## 贡献者

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

## 支持

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

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