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

Sunburst Code Prettify

描述

This plugin uses the Sunburst theme, a colorful and high contrast dark theme to highlight your code syntax with Highlight.js. Highlight.js is accurate, fast, lightweight and easy to use.

Usage

Short-code method:

  1. From within a WordPress page or post, wrap the [prettify][/prettify] shortcode around the code snippet you wish to highlight.
  2. You can specify a language by specifying the language extension inside the shortcode.
    Example:
    [prettify class=”html”][/prettify]
  3. The shortcode will work from within either the Visual or HTML editor.

Non-short-code method:

  1. Wrap your code snippets in “

    .

  2. You can specify a language by specifying a class in the element.
    Example:
    <pre><code class="html">

Sunburst Only

This plugin only contains the CSS file for the Sunburst theme syntax highlighting formatting, because it is the best dark syntax theme. If (for some reason) you wanted to highlight your code using a different theme, there are other syntax highlighting themes available in the Highlight.js Theme Gallery

Languages Supported:

  • Bash
  • C#
  • C++
  • CSS
  • Diff
  • HTML, XML
  • Ini
  • Java
  • JavaScript
  • PHP
  • Perl
  • Python
  • Ruby
  • SQL

屏幕截图

  • PHP code examples
  • CSS code example
  • HTML code example
  • JavaScript code example
  • Ruby code example

安装

  1. Wrap code snippets in [prettify][/prettify] shortcode and it will guess the syntax being used and highlight the code.

  2. You can specify a language by specifying the language extension inside the shortcode.
    Example:
    [prettify class=”html”][/prettify]
    The class=”” specifies the language file extensions.

评价

此插件暂无评价。

贡献者及开发者

“Sunburst Code Prettify” 是开源软件。 以下人员对此插件做出了贡献。

贡献者

将“Sunburst Code Prettify”翻译成您的语言。

对开发感兴趣吗?

您可以浏览代码,查看SVN仓库,或通过RSS订阅开发日志

更新日志

2.2.0

  • Changed syntax highlight script to Highlight.js for more accurate code detection.
  • Improved content stripping rules for WordPress code editor when the [prettify]...[/prettify] is wrapped around content.
  • Improved Sunburst CSS styles

2.1.6

  • Added plain text color to CSS file
  • Adjusted spacing in CSS file
  • Updated copyright year in plugin.php file

2.1.5

  • Added CSS parsing js file
  • Moved JS files into /js folder
  • Fixed missing files from 2.1 commit

2.1

  • Added [prettify] shortcode
  • Automatically added the required onload=”prettyPrint()” to body tag with jquery

2.0

  • Initial WordPress.org commit