Title: Snippets Block
Author: Luis Sacristán
Published: <strong>2019 年 4 月 4 日</strong>
Last modified: 2019 年 4 月 29 日

---

搜索插件

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

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

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

# Snippets Block

 作者：[Luis Sacristán](https://profiles.wordpress.org/displaynone/)

[下载](https://downloads.wordpress.org/plugin/snippets-block.1.3.0.zip)

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

 [支持](https://wordpress.org/support/plugin/snippets-block/)

## 描述

Allows to add snippets blocks to your content: Javascript, CSS, HTML…

### Purpose

Add snippet blocks to your WordPress content using the new Gutenberg editor

### How to use it

 * Add a Snippet block within your content
 * Include your code
 * Select the language
 * Save the post and check your front-end

### Supported languages

 * Apache
 * Bash
 * C#
 * C++
 * CSS
 * Erlang
 * Go
 * HTML
 * XML
 * Handlebars
 * JSON
 * Java
 * JavaScript
 * Markdown
 * Objective C
 * PHP
 * Python
 * R
 * Ruby
 * Rust
 * SCSS
 * SQL
 * Shell
 * Twig
 * TypeScript

### Credits

 * Based in Making WordPress Do More [Block Starter Kit](https://github.com/mkdo/block-starter-kit)
 * Original webpack configuration (before modifications) from [Zac Gordon\’s Gutenberg Course](https://github.com/zgordon/gutenberg-course).
 * Original deploy script (before modifications) from [Garry Jones](https://github.com/GaryJones/wordpress-plugin-git-flow-svn-deploy).
 * Webpack HMR thanks to [Christian Glingener](https://github.com/CGlingener)

### Requirements

Gutenberg activated

### Known Issues

There are no known issues at this time.

### Roadmap

 * Allow several themes

## 安装

 1. Backup your WordPress install
 2. Upload the plugin folder to the `/wp-content/plugins/` directory
 3. Activate the plugin through the \’Plugins\’ menu in WordPress

## 常见问题

  What library does this plugin use?

It uses [highlight.js](https://highlightjs.org/)

  What highlight.js theme uses?

androidstudio

## 评价

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

### 󠀁[Working on WP5.5](https://wordpress.org/support/topic/working-on-wp5-5/)󠁿

 [Anonymous User 17638488](https://profiles.wordpress.org/anonymized-17638488/) 
2020 年 8 月 20 日

HighlightJS supports a heap of different languages and snippets-block can be modified
to include more than it’s current default. Works well simple and straight forward

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

### 󠀁[Nice and simple](https://wordpress.org/support/topic/nice-and-simple-208/)󠁿

 [Josh](https://profiles.wordpress.org/joshintosh/) 2019 年 5 月 18 日

This is great, nice and simple. It even worked with our old posts that were written
in the old editor. As long as the text is in a <code> tag it’s good to go. Thanks
for the quick solution!

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

### 󠀁[Simple and straight-forward](https://wordpress.org/support/topic/simple-and-straight-forward-27/)󠁿

 [WPMadeasy](https://profiles.wordpress.org/wpmadeasy/) 2019 年 4 月 11 日

Nice, simple and straightforward – just add the block and start typing your script.
No fancy tidbits to get you distracted. Very useful when you are dragged between
several choices – just go for it.

 [ 阅读所有3条评价 ](https://wordpress.org/support/plugin/snippets-block/reviews/)

## 贡献者及开发者

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

贡献者

 *   [ Luis Sacristán ](https://profiles.wordpress.org/displaynone/)

[帮助将「Snippets Block」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/snippets-block)

### 对开发感兴趣吗?

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

## 更新日志

#### 1.3.0

 * Added Spanish translation.

#### 1.2.1

 * Fixed line numbers with long lines.

#### 1.2.0

 * Added line numbers. Thanks [Waqas Bin Hasan](https://wordpress.org/support/users/waqasb/)
   for the tip.

#### 1.1.0

 * Added copy button: it allows to copy to clipboard the content of the snippet
 * Save formatted code: instead of parsing the content using `highlight.js` in the
   front-end, the HTML is saved directly in the backend
 * Fixed `filemtime` in Windows

#### 1.0.1

 * Cleaning some first SVN version mess

#### 1.0.0

 * First version.

## 额外信息

 *  版本 **1.3.0**
 *  最后更新：**7 年前**
 *  活跃安装数量 **100+**
 *  WordPress 版本 ** 5.0 或更高版本 **
 *  已测试的最高版本为 **5.2.24**
 *  语言
 * [English (US)](https://wordpress.org/plugins/snippets-block/)
 * 标签
 * [blocks](https://cn.wordpress.org/plugins/tags/blocks/)[gutenberg](https://cn.wordpress.org/plugins/tags/gutenberg/)
   [highlight.js](https://cn.wordpress.org/plugins/tags/highlight-js/)
 *  [高级视图](https://cn.wordpress.org/plugins/snippets-block/advanced/)

## 评级

 5 星（最高 5 星）。

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

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

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

## 贡献者

 *   [ Luis Sacristán ](https://profiles.wordpress.org/displaynone/)

## 支持

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

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