Linux 软件免费装
Banner图

iG:Syntax Hiliter

开发者 amit
更新时间 2026年8月22日 23:45
PHP版本: 8.4 及以上
WordPress版本: 7.1.0
版权: GPLv2 or later
版权网址: 版权信息

标签

html css javascript php code code highlighter syntax highlighter source code mysql

下载

5.1 6.0.0

详情介绍:

iG:Syntax Hiliter allows you to post source code to your site with syntax highlighting and formatting (as seen in code editors, IDEs). You can paste the code as is from your code editor or IDE and this plugin will take care of all the code colouring and preserve your formatting. It uses the Prism.js library to colourise your code and supports ~300 programming languages, all of which are bundled with the plugin. You can write code snippets using the Gutenberg block editor or using this plugin's shortcodes in the classic editor's Code view. Both are supported. The classic editor's Visual (WYSIWYG) tab is not supported and never has been — it mangles code before the plugin ever sees it. NOTE : Highlighting happens in the visitor's browser, not on your server. Prism's files are loaded only on pages that actually contain a code snippet and it loads only the languages that page needs. Minimum Requirements Pull requests are welcome on Github. Github: https://github.com/coolamit/ig-syntax-hiliter/

安装:

UPGRADING from v4.0 or later Just click update now link below the plugin listing on the plugins page in your wp-admin. That's quite easy!! Do read the Important changes in 6.0.0 section above first. Your existing posts keep working, but there are a few things worth knowing before you open an old post in the block editor. UPGRADING from v3.x Just deactivate plugin in WordPress admin, delete the syntax_hilite.php file & ig_syntax_hilite directory from plugins folder and follow the installation process below. That's quite easy!! UPGRADING from v2.1 or lower Just deactivate plugin in WordPress admin, delete the syntax_hilite.php and geshi.php files & geshi directory from plugins folder and follow the installation process below. That's quite easy!! Installing The Plugin
  1. Login to your WordPress wp-admin area.
  2. Click Add New in the Plugins menu on left.
  3. Enter iG:Syntax Hiliter in the search bar on the right on the page that opens and press Enter key.
  4. WordPress would show the iG:Syntax Hiliter plugin with install button, click that to install the plugin.
  5. Click on Activate Plugin link on the page that opens after the plugin has been installed successfully.
See Also: "Installing Plugins" in the WP documentation

屏幕截图:

  • Settings page — comment highlighting and Gist embed options.
  • Gutenberg block editor with "iG:Syntax Hiliter" block selected.
  • Gutenberg block editor with "iG:Syntax Hiliter Gist" block selected.
  • Classic editor with code snippets added with shortcodes.

升级注意事项:

6.0.0 GeSHi is replaced by Prism.js and Gutenberg support added. Requires PHP 8.4 and WordPress 6.9. Old posts keep working, but opening one in the block editor converts its snippets to blocks — read "Important changes in 6.0.0" before updating. 5.1 Major refactor of plugin code for compatibility with PHP 7.4.0 and above.

其他记录:

Documentation on plugin usage and configuration

常见问题:

My code looks all odd, characters appear as HTML entities. Why is your plugin screwing up my code?

If you are writing your post in the classic editor's Visual (WYSIWYG) tab then that is what is messing things up for you. That tab is TinyMCE, it treats your code as HTML and it does its damage before this plugin ever sees the content. It has never been supported. Use the block editor or the classic editor's Code view. If you are using either of those and still see this, please report it.

I opened an old post in the block editor and my code blocks turned into iG:Syntax Hiliter blocks. Why?

Because leaving them alone was worse. See the Important changes in 6.0.0 section above for the full explanation. Short version: the block editor loads a classic post into one big TinyMCE block, TinyMCE eats code and converting the snippets to blocks first is the only way to stop that. The conversion is only written to the post if you save it and it leaves the rest of your post byte-for-byte as it was.

What happens to my code if I deactivate the plugin?

Snippets still stored as shortcodes stay visible as [sourcecode]…[/sourcecode] text — ugly, but you can see them and do something about them. Snippets that have been converted to blocks render as nothing at all, because the block is no longer registered, and a Gist block goes the same way. Before deactivating, use the tool in the Before you deactivate section of the plugin's settings page to turn those blocks back into shortcodes — [sourcecode] for a code block and [github] for a Gist block. Every block converts, this plugin's own tags in the code included.

I used to add languages by putting GeSHi language files in the plugin's or my theme's geshi directory. What now?

Both of those mechanisms are gone with GeSHi. Approx 300 languages ship with the plugin now, so start by checking whether yours is one of them — use it with [sourcecode language="…"] or pick it in the block.

How do I show one of this plugin's own tags inside a code box?

Double its brackets. [[php]] shows a reader [php] and [[/php]] shows [/php], so a whole example fits inside a snippet: [sourcecode language="php"] [[sourcecode language="php"]] echo 'hello'; [[/sourcecode]] [/sourcecode] Without this the snippet would end at the first closing tag in its code and everything after it would be lost. What is stored is what you typed — the extra brackets come off on the way to a reader and nowhere else — and the rule applies to itself, so [[[/php]]] shows a reader [[/php]].

I see some code that I can improve. Do you accept pull requests?

By all means, feel free to submit a pull request.

I want XYZ feature. Can you implement it?

Please feel free to suggest a new feature. Its inclusion might be speedier if you can provide the code to make it work.

更新日志:

v6.0.0 v5.1 v5.0 v4.3 v4.2 v4.1 v4.0 v3.5 v3.1 v3.0 v2.01 v2.0 Final v2.0 Preview v1.1 v1.0