Despite two plugins already on wordpress.org I decided to write my own from scratch. The result is a minimalistic but powerful plugin with only ~250 lines of PHP.
- Supports every possible Prism configuration.
- Adds TinyMCE dropdown lost for
<code class="language-xxx"> and <pre class="language-xxx">for bash, css, js, markup, php, scss. (I can make a filter if you want to add more.)
- Does not load prism on every page, only when needed.
- Supports automatic detection of prism HTML.
- Supports displaying code from custom fields with
- Developers may use the
prismhandle to enqueue the pre-registered script and style.
- Has admin editor button for quick shortcode template snippet.
- Has no options page by design.
- Read more -> Prism Syntax Highlighter for WordPress
Bundled Prism Version (2016-09-17)
- Sass (Scss)
- Line Highlight
- Line Numbers
- WebPlatform Docs
- Show Language
No idea how.
- Will the data mining ever end?
What data mining?
Doesn't work, which is too bad 🙁
I find that this plugin does what it's supposed to do, and then some. Pity that often, I do not write code which is very serious, because if I did, then this plugin would allow me to blog about that code in style. 🙂 The instructions should be followed however, to download the JS and CSS Files from the prescribed Web-site, suggested by the plugin author, and to create a directory wherever our blog has its 'uploads' folder, so that a subdirectory exists with the name '.../uploads/prism/' , and then to put those two customized files into that directory. This does not strike me as complicated, but fulfills the promise that the color scheme etc. can be customized. That version of the plugin will be used for the public version of our blog, while the built-in version of the files will be used in our editor preview panel. Dirk
It works great thx. Please add json.
“Prism Syntax Highlighter for WordPress” 是一個開源的軟體。以下的人對這個外掛作出了貢獻。貢獻者
將 Prism Syntax Highlighter for WordPress 外掛本地化為台灣繁體中文版。
1.1.0 – 2016-09-18
- Updated bundled prism.js.
- Added quotes to the shortcode included with the buttin click.
- Always scan archives, abodon the define switch.
- Added TinyMCE dropdown styles to style
<pre>tags with language-xxx classes.
- Added SVG icon for plugin installer
- Updated bundled Prism version
- Fix: Missing data-manual output
- Improved: WTFAQ
- Fix: Screenshots