[wordpress插件] CC-Syntax-HighlightCC语法高亮

wordpress 插件 文章 2020-03-19 17:40 0 187 全屏看文

The CC-Syntax-Highlight plugin supports syntax highlighting of Posts, Pages, and any public Custom Post Types.


It uses highlight.js or

它使用 highlight.js

="nofollow">google-code-prettify libraries.

=“ nofollow”> google-pretify 库。

Additionally it can use the clipboard.js library to add a button that copies text to the clipboard and clipboard.js 库添加将文本复制到剪贴板的按钮和

://github.com/wcoder/highlightjs-line-numbers.js/" rel="nofollow">highlightjs-line-numbers.js plugin to add line numbers.

://github.com/wcoder/highlightjs-line-numbers.js/“ rel =” nofollow“> highlightjs-line-numbers.js 插件以添加行号。

It is delivered with support for shortcode (default

 – you can change it on the settings page) which automatically converts all special characters to HTML entities.

它附带对短码的支持(默认[code] –您可以在设置页面上对其进行更改),该功能会自动将所有特殊字符转换为HTML实体。

This plugin is compatible with Multisite WordPress installations.


How does it work?


    1. Go to the ‘Settings > Syntax Highlight’ page, select your preferred options and save them.
    2. 转到“设置>语法突出显示”页面,选择所需的选项并保存。

    3. Simply add the source code to your post (or other selected public Custom Post Type) wrapped with:

    4. 只需将源代码添加到您的帖子(或其他选定的公共自定义帖子类型)中,并用以下内容包装:

      Your source code


      or if you would like to automatically convert all special characters to HTML entities, use shortcode wrapper instead (default [code] – you can change it on the settings page):

      或者,如果您想将所有特殊字符自动转换为HTML实体,请改用简码包装器(默认[code] –您可以在设置页面上对其进行更改):

      [code]Your source code
    5.  [code]您的源代码[/ code]  

    Plugin’s js scripts and css styles files only load if the source code occurs on displaying page.



From your WordPress Dashboard


    1. Go to ‘Plugins > Add New’
    2. 转到“插件>添加新内容”

    3. Search for ‘CC-Syntax-Highlight’
    4. 搜索“ CC语法高亮”

    5. Activate the plugin from the Plugin section on your WordPress Dashboard.
    6. 从WordPress仪表板上的“插件”部分激活插件。

    From WordPress.org


      1. Download ‘CC-Syntax-Highlight’.
      2. 下载“ CC-语法-重点”。

      3. Upload the ‘cc-syntax-highlight’ directory to your ‘/wp-content/plugins/’ directory using your favorite method (ftp, sftp, scp, etc…)
      4. 使用您喜欢的方法(ftp,sftp,scp等)将“ cc-syntax-highlight”目录上传到您的“ / wp-content / plugins /”目录

      5. Activate the plugin from the Plugin section in your WordPress Dashboard.
      6. 从WordPress信息中心的“插件”部分激活插件。

      Once Activated


        1. Visit the ‘Settings > Syntax Highlight’ page, select your preferred options and save them.
        2. 访问“设置>语法突出显示”页面,选择您喜欢的选项并保存。



        The plugin can be activated and used for just about any use case.


          • Activate at the site level to load the plugin on that site only.
          • 在站点级别激活以仅在该站点上加载插件。

          • Activate at the network level for full integration with all sites in your network (this is the most common type of multisite installation).
          • 在网络级别激活以与网络中的所有站点完全集成(这是多站点安装的最常见类型)。