This plugin does not collect any user data. So it does _not_ do anything to make your site _less_ compliant with GDPR. I have done my best to ensure that this plugin is 100% GDPR compliant, but I'm not a lawyer so can't guarantee anything. To determine if your site is GDPR compliant, please consult an attorney.
If you like Prismatic, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/prismatic/reviews/?rate=5#new-post). It helps to keep development and support going strong. Thank you!
The Prismatic plugin follows the same conventions used by [Prism.js](http://prismjs.com/) and [Highlight.js](https://highlightjs.org/). Here are the basic steps:
1. Visit the Prismatic General Settings and choose your library
2. Visit the settings tab for your chosen library
3. Choose a theme and configure your options
Once the settings are configured, you can enable syntax highlighting for any code snippet by doing one of the following:
With the proper markup in place, you can indicate a specific language by adding a class of `language-abc` or `lang-abc` to the <code> tag (where "abc" is the language identifier). For example, to indicate PHP as the language for a single-line code snippet:
Note: in the previous example, ignore the `class="optional"` added to the code tag; it is used to prevent markdown from mangling the code example on this web page.
Basically, the prefix of the class names (i.e., "lang-" or "language-") are the same for Prism.js and Highlight.js. The difference is the language identifier (e.g., "css" or "html") used to specify each language. Check out the following "About Prism.js" and "About Highlight.js" sections for more information.
__Note:__ In addition to detecting the `language-` and `lang-` prefixes, Highlight.js also will try to auto-detect the language without it being specified. Plus as an option, you can enable the Highlight.js setting, "Support no-prefix class names" to enable use of language identifiers without any `language-` or `lang-` prefix.
For example, the code snippets included in either of the following markup examples would be escaped (note that the class attribute is not required for code escaping).
So what exactly happens when the "Code Escaping" options are enabled? Here is a summary that applies to each section (post content, excerpts, and comments):
* __Frontend only__ - code snippets are escaped at runtime (no changes made to content in the database)
* __Admin Area only__ - code snippets are escaped when viewed via the Admin Area (changes will be saved to database if the "Update" or "Publish" button is clicked)
Note that each library — Prism.js, Highlight.js, and Plain Flavor — features its own code-escape settings. So the code-escape settings that are applied depends on the currently active library. Visit the plugin's General Settings to choose your library. Then visit that library's tab to configure its code-escape settings.
When code escaping is enabled for either/both the frontend or Admin Area, the plugin makes the following changes to any code contained within <code></code> tags:
These are the _only_ changes made to your code, no other changes are made.
As mentioned, the difference between code escaping on the frontend vs. the Admin Area is that, on the frontend, the above changes are made at runtime and not saved to the database; whereas in the Admin Area, the changes are made when the code is viewed via a content editor, such that any changes made will be saved to the database when the user clicks the "Update" or "Publish" button. Please keep this in mind when choosing your code-escape settings.
__Important!__ As explained, enabling code escaping in the Admin Area may result in the escaped code getting saved in the database. This is fine in most cases, but there may be situations where escaping should only happen at runtime. If that is the case, or if you are unsure, choose the "Frontend only" option for the "Code Escaping" setting. The "Frontend only" option only modifies code when displayed on the frontend and does not save any changes to the database.
Note: in the previous example, ignore the `class="optional"` added to the code tag (for the "Alternate" syntax); it is used to prevent markdown from mangling the code example on this web page.
Note: in the previous example, ignore the `class="optional"` added to the code tag (for the "Alternate" syntax); it is used to prevent markdown from mangling the code example on this web page.
To disable Highlight.js syntax highlighting for any code block, add a class of `nohighlight`, like so:
<code class="nohighlight">...</code>
_I'm glad to add more languages, [make a suggestion](https://perishablepress.com/contact/)_
== Upgrade Notice ==
To upgrade Prismatic, remove the old version and replace with the new version. Or just click "Update" from the Plugins screen and let WordPress do it for you automatically.
__Note:__ uninstalling the plugin from the WP Plugins screen results in the removal of all settings from the WP database.
== Frequently Asked Questions ==
**Can you add another language for Prism.js or Highlight.js?**
Yes, feel free to [suggest a language](https://perishablepress.com/contact/)
As of now, WP 5.0 beta, Gutenberg does not support `<pre>` and `<code>` tags. Currently with the Gutenberg Block Editor, if you try to add for example `<pre><code class="language-javascript">` to your post content, Gutenberg will transform it into `<pre class="wp-block-preformatted">`. Even switching to "Edit as HTML" and transforming the block into "Preformatted", the result is the same: mangled `<pre>` and `<code>` tags. So until this is fixed in WP, it is impossible to add syntax-highlighted code. Thus, highlighting plugins like Prismatic simply cannot do their jobs.
NOTE: If you need to work with pre/code snippets, you can disable Gutenberg Block Editor using my free plugin, [Disable Gutenberg](https://wordpress.org/plugins/disable-gutenberg/). It restores the Classic Editor so you can work easily with code snippets and other elements in your post content. This is how I roll for all the code I share over at [Perishable Press](https://perishablepress.com/), [Digging Into WordPress](https://digwp.com/), and elsewhere.
I develop and maintain this free plugin with love for the WordPress community. To show support, you can [make a donation](https://monzillamedia.com/donate.html) or purchase one of my books: