兼容性WordPress代码高亮插件Enlighter – Customizable Syntax Highlighter

WordPress写文章时经常要引用代码,Wordpress也有很多代码高亮插件,例如WP-Syntax、Crayon Syntax Highlighter、SyntaxHighlighter Evolved、Code Prettify等,这些Wordpress代码插件安装简单,使用方便,直接启用就可以在Wordpress撰写文章中使用了。

不过,自从Wordpress升级使用了古腾堡编辑器后,好多的WP代码高亮插件就无法使用了,而且好多的Wordpress代码高亮插件对于WP的主题的要求比较高,有一些自定义的WP主题可能存在与Wordpress代码高亮插件相冲突的地方,导致出现这样或者那样的问题。

众多的WordPress代码高亮插件中,Enlighter在兼容性方面做得不错,支持Gutenberg和TinyMCE编辑器,尤其是对古腾堡编辑器支持很好,且几乎支持市面上所有的语言,例如CSS、Html、Java、PHP、SQL、YAML、Ruby等,可以称得上全能型的代码高亮插件了。

Enlighter – Customizable Syntax Highlighter插件地址:https://cn.wordpress.org/plugins/enlighter/

Enlighter – Customizable Syntax Highlighter

插件功能

  • Full Gutenberg Editor Integration
  • Full Classic Editor Integration (TinyMCE)
  • 支持所有常用开发语言
  • Powerful generic highlighting engine for unknown/unsupported languages
  • Theme Customizer
  • Inline Syntax Highlighting
  • Advanced configuration options are available within the options page.
  • Supports code-groups (displays multiple code-blocks within a tab-pane)
  • Extensible language and theme engines – add your own one.
  • Simple CSS based themes
  • Integrated CSS file caching (suitable for high traffic sites)
  • Full GDPR compliant – no external resources are required, no data will be aggregated

安装

System requirements

  • WordPress 6.0
  • PHP 7.4, including json functions
  • Modern webbrowser with enabled Javascript (required for highlighting)
  • Accessable cache directory (/wp-content/plugins/enlighter/cache/)

Installation

  • Download the .zip file of the plugin and extract the content
  • Upload the complete enlighter folder to the /wp-content/plugins/ directory
  • 通过WordPress的“插件”菜单激活插件
  • Goto to the Enlighter settings page and select the default theme which should be used.
  • That’s it! You’re done. Just go into your editor and add an Enlighter codeblock via Gutenberg Blocks menu or Classic Editor toolbar

👋 感谢您的观看!

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享