Integrates the Prism Syntax Highlighting Library in WordPress.
It is called detached, since the code examples are not stuffed into the rich text editor, together with all the
other texts and content, but they are added separately as custom fields and just referenced via short tags (like footnotes).
Check Other Notes for usage documentation.
The official development repository is hosted on Github.
The basic procedure is:
- Create a custom field and paste the code into it.
- Insert the
[prism ...]shorttag in your code, where you want the code block to appear.
[prism key=".." language=".." line=".." line_offset=".." post=".."]
key: the name of the custom field, which contains the code (required)
language: the language to highlight
line: highlighted lines (for syntax, check the offical docs)
line_offset: the offset, with which the line numbering should start
post: if you want to include a code piece of another post, you can explicitly specify the post id here
Cached Assets loader
The plugin includes (from v1.3 on) a cached assets loader, so that all needed assets are concatenated into
one js and one css file to minimize the HTTP requests.
To make use of the cached assets loader, just create a directory
/cache/ inside your plugin directory and make it writable for PHP.
Only the ones from the official PrismJS repository
- bash (Bash Unix Shell)
- cpp (C++)
- markup (like: xHTML, MathML, SVG, LaTeX, RSS, XML, OWL, etc.)
- scss (Sassy CSS)
Creating Custom Extensions
Please read the wiki page: Creating A Custom Extension.
- Upload the files to your
- Activate the plugin through the ‚Plugins‘ menu in WordPress
- Why use custom tags?
The (rich text) editor of WordPress is quite good in mangling in manually added code. This cannot happen with custom fields.
Also, I personally, think it is more user-friendly.
Za tutón tykač pohódnoćenja njejsu.
Sobuskutkowarjo a wuwiwarjo
„Prism Syntax Highlighter (detached)“ je softwara wotewrjeneho žórła. Slědowacy ludźo su k tutomu tykačej přinošowali.Sobuskutkowarjo
Na wuwiću zajimowany?
- Updated PrismJS to commit: 07c0f4f6b2
- Added plugin descriptions
- Added new plugins: File Highlight, WebPlatform Docs
- Added language-code descriptions
- Added new languages: Bash (Unix Shell), C, C-like, Coffeescript, C++, Groovy, PHP, Python, Sassy CSS, and SQL
- Added new themes: Okaida, Tomorrow, Twilight
** 1.5 update brought to you by JC John Sese Cuneta (http://jcsesecuneta.com) ** thank you!
- Fixed a compatibility problem with older PHP versions (< 5.4)
- Minor optical updates of the admin interface
- Refactored nearly complete plugin
- Added support for generic extensions
- Added cached assets loader
- Added support for experimental PHP plugin
- Updated the prism library to
- Load line-highlight correctly
- Moved html attributes to the correct tag
- Fixed wrong asset loading
- Initial commit