We'll create fresh WordPress site with Prism Syntax Highlighter (detached) installed. You have 20 minutes to test the plugin after that site we'll be deleted.
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:
[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 highlightline
: highlighted lines (for syntax, check the offical docs)line_offset
: the offset, with which the line numbering should startpost
: if you want to include a code piece of another post, you can explicitly specify the post id hereThe 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
Please read the wiki page: Creating A Custom Extension.