Title: Xhtheme Code Block
Author: xhtheme
Published: <strong>2025 年 2 月 6 日</strong>
Last modified: 2025 年 9 月 3 日

---

搜索插件

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

# Xhtheme Code Block

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

[下载](https://downloads.wordpress.org/plugin/xhtheme-code-block.1.0.2.zip)

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

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

## 描述

Xhtheme Code Block is a plugin for adding code blocks to your WordPress site, supporting
syntax highlighting and adapting to the theme’s light and dark mode switching.

 * Supports syntax highlighting for multiple programming languages.
 * Allows selection of light, dark, or auto mode.
 * Supports custom filename display.

### External Libraries

 * **Alpine.js**:
    - Version: 3.x.x
    - Source: [Alpine.js Official Website](https://alpinejs.dev/)
    - Description: Alpine.js is a lightweight JavaScript framework for adding interactivity
      to HTML. It is used in the Xhtheme Code Block plugin to manage the reactive
      state of the settings page, allowing for dynamic updates and user interactions
      without the need for page reloads.
 * **Prism.js**:
    - Version: 1.x.x
    - Source: [Prism.js Official Website](https://prismjs.com/)
    - Description: Prism.js is a lightweight, extensible syntax highlighter, built
      with modern web standards in mind. It is used in the Xhtheme Code Block plugin
      to provide syntax highlighting for a wide range of programming languages.

### Source Code

The source code for `build/index.js` can be found in the `block-code/src` directory.

## 区块

该插件提供了 1 个区块.

 *   Code Block A customizable code block component for displaying and editing code
   snippets with syntax highlighting.

## 安装

 1. Upload the `xhtheme-code-block` folder to the `/wp-content/plugins/` directory.
 2. Activate the plugin through the ‘Plugins’ menu in WordPress.
 3. Configure the plugin options under ‘Settings’ -> ‘Xhtheme Code Block’.

## 常见问题

### What languages are supported?

The Code Syntax Block plugin uses the Prism autoloader plugin to support all of 
the languages Prism supports. See the [list of supported languages here](https://prismjs.com/#supported-languages).

### How do I switch the display mode of the code block?

You can select light, dark, or auto mode on the plugin settings page.

## 评价

此插件暂无评价。

## 贡献者及开发者

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

贡献者

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

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

### 对开发感兴趣吗?

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

## 更新日志

#### 1.0.2

Compatible with WordPress 6.8

#### 1.0.1

Fixed potential data sanitization issues.

#### 1.0

 * Initial release.

## 额外信息

 *  版本 **1.0.2**
 *  最后更新：**9 月前**
 *  活跃安装数量 **10+**
 *  WordPress 版本 ** 5.0 或更高版本 **
 *  已测试的最高版本为 **6.8.5**
 *  PHP 版本 ** 7.2 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/xhtheme-code-block/)
 * 标签
 * [block](https://cn.wordpress.org/plugins/tags/block/)[code](https://cn.wordpress.org/plugins/tags/code/)
   [dark mode](https://cn.wordpress.org/plugins/tags/dark-mode/)[gutenberg](https://cn.wordpress.org/plugins/tags/gutenberg/)
   [syntax highlighting](https://cn.wordpress.org/plugins/tags/syntax-highlighting/)
 *  [高级视图](https://cn.wordpress.org/plugins/xhtheme-code-block/advanced/)

## 评级

尚未提交反馈。

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

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

## 贡献者

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

## 支持

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

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

## 捐助

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

 [ 捐助此插件 ](https://paypal.me/xhtheme)