You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.txt 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. === Prismatic ===
  2. Plugin Name: Prismatic
  3. Plugin URI: https://perishablepress.com/prismatic/
  4. Description: Display beautiful syntax-highlighted code snippets with Prism.js or Highlight.js
  5. Tags: code, snippets, syntax, highlight, language, snippet, pre, prettify, prism, css, fence
  6. Author: Jeff Starr
  7. Contributors: specialk
  8. Author URI: https://plugin-planet.com/
  9. Donate link: https://monzillamedia.com/donate.html
  10. Requires at least: 4.1
  11. Tested up to: 5.0
  12. Stable tag: 1.8
  13. Version: 1.8
  14. Requires PHP: 5.2
  15. Text Domain: prismatic
  16. Domain Path: /languages
  17. License: GPL v2 or later
  18. Display beautiful syntax-highlighted code snippets with Prism.js or Highlight.js
  19. == Description ==
  20. __The only 3-in-1 syntax highlighter!__
  21. Display beautiful code snippets with Prism.js, Highlight.js, or plain code escaping:
  22. * __Prism.js__ - Code escape + syntax highlight using [Prism.js](http://prismjs.com/)
  23. * __Highlight.js__ - Code escape + syntax highlight using [Highlight.js](https://highlightjs.org/)
  24. * __Plain Flavor__ - Code escape without syntax highlight
  25. **Prism.js Features**
  26. * Supports __41__ coding languages
  27. * Choose from all __8__ available Prism themes
  28. * Enable Prism plugin [Line Numbers](http://prismjs.com/plugins/line-numbers/)
  29. * Enable Prism plugin [Line Highlight](http://prismjs.com/plugins/line-highlight/)
  30. * Enable Prism plugin [Show Language](http://prismjs.com/plugins/show-language/)
  31. * Highlights code in post content, excerpts, and comments
  32. * Detects `language-` and `lang-` class prefixes
  33. * Limit syntax highlighting to Posts and Pages
  34. * Highlight single-line and multi-line code
  35. * Granular control over code escaping
  36. * Smart loading of CSS & JS assets
  37. **Highlight.js Features**
  38. * Supports __31__ coding languages
  39. * Choose from all __79__ available Highlight themes
  40. * Customize the Highlight.js init JavaScript
  41. * Highlights code in post content, excerpts, and comments
  42. * Limit syntax highlighting to Posts and Pages
  43. * Highlight multi-line blocks of code
  44. * Detects `language-` and `lang-` class prefixes
  45. * Enable support for no-prefix class names
  46. * Granular control over code escaping
  47. * Smart loading of CSS & JS assets
  48. **Plain Flavor Features**
  49. * Enable code escaping for post content, excerpts, and/or comments
  50. * Enable code escaping on the frontend, Admin Area, or both
  51. * Escapes single-line and multi-line code snippets
  52. * Escapes `<code>` tags based on configuration
  53. **General Features**
  54. * Easy to set up &amp; configure
  55. * Built with the WordPress API
  56. * Squeaky clean, error-free code
  57. * Born of simplicity, no frills
  58. * Lightweight, fast and flexible
  59. * Focused on performance and security
  60. * Loads CSS/JS assets only when required
  61. * Adheres to HTML coding best practices
  62. * Regularly updated and "future proof"
  63. _Prismatic escapes only the essentials to keep your code clean._
  64. [Check out the screenshots](https://wordpress.org/plugins/prismatic/screenshots/) for more details!
  65. **GDPR**
  66. 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.
  67. == Screenshots ==
  68. 1. Prismatic General Settings
  69. 2. Prismatic Prism.js Settings
  70. 3. Prismatic Highlight.js Settings
  71. 4. Prismatic Plain Flavor Settings
  72. 5. Prism.js : Twilight theme (choose from 7 Prism.js themes!)
  73. 6. Highlight.js : Arduino Light theme (choose from 77 Highlight.js themes!)
  74. 7. Highlight.js : Gruvbox Dark theme (choose from 77 Highlight.js themes!)
  75. 8. Cleanly escaped code without syntax highlighting (Plain Flavor)
  76. == Installation ==
  77. **Installing Prismatic**
  78. 1. Make a backup of your database
  79. 2. Upload the plugin to your blog and activate
  80. 3. Visit the plugin settings to configure options
  81. __Note:__ Please read the section below on "code escaping" to understand how it works.
  82. _[More info on installing WP plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins)_
  83. **Like the plugin?**
  84. 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!
  85. **Uninstalling**
  86. Prismatic cleans up after itself. All plugin settings will be removed from your database when the plugin is uninstalled via the Plugins screen.
  87. **Restore Default Options**
  88. To restore default plugin options, either uninstall/reinstall the plugin or visit the Prismatic General Settings &gt; Restore default plugin options.
  89. **Usage: Syntax Highlighting**
  90. 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:
  91. 1. Visit the Prismatic General Settings and choose your library
  92. 2. Visit the settings tab for your chosen library
  93. 3. Choose a theme and configure your options
  94. Once the settings are configured, you can enable syntax highlighting for any code snippet by doing one of the following:
  95. * Wrap multi-line code with pre &amp; code tags: &lt;pre&gt;&lt;code&gt;...&lt;/code&gt;&lt;/pre&gt;
  96. * Wrap single-line code with code tags: &lt;code&gt;...&lt;/code&gt;
  97. __Note:__ Prism.js highlights both multi-line and single-line code snippets. Highlight.js only supports multi-line code snippets.
  98. With the proper markup in place, you can indicate a specific language by adding a class of `language-abc` or `lang-abc` to the &lt;code&gt; tag (where "abc" is the language identifier). For example, to indicate PHP as the language for a single-line code snippet:
  99. <code class="language-php"><?php echo 'Hello world'; ?></code>
  100. Likewise, to indicate HTML as the language for a multi-line code snippet:
  101. <pre><code class="language-html">
  102. <table>
  103. <tr>
  104. <th>Name</th>
  105. <th>Side</th>
  106. <th>Role</th>
  107. <tr>
  108. <td>Darth</td>
  109. <td>Dark</td>
  110. <td>Sith</td>
  111. </tr>
  112. </table>
  113. </code></pre>
  114. Alternately, the language class may be placed on the &lt;pre&gt; tag, for example:
  115. <pre class="language-html"><code>
  116. <table>
  117. <tr>
  118. <th>Name</th>
  119. <th>Side</th>
  120. <th>Role</th>
  121. <tr>
  122. <td>Darth</td>
  123. <td>Dark</td>
  124. <td>Sith</td>
  125. </tr>
  126. </table>
  127. </code></pre>
  128. 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.
  129. __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.
  130. > Pro Tip: Language class names work when added to the &lt;pre&gt; tag for both Prism.js and Highlight.js.
  131. **Usage: Code escaping**
  132. Just like Prism.js and Highlight.js, the Prismatic plugin follows HTML coding standards. To enable code escaping:
  133. 1. Visit the Prismatic General Settings and choose your library
  134. 2. Enable "Code Escaping" via the settings tab of your chosen library
  135. 3. Do one of the following:
  136. * Wrap multi-line code with pre &amp; code tags: &lt;pre&gt;&lt;code&gt;...&lt;/code&gt;&lt;/pre&gt;
  137. * Wrap single-line code with code tags: &lt;code&gt;...&lt;/code&gt;
  138. 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).
  139. This is a single-line example:
  140. <code class="language-php"><?php echo 'Hello world'; ?></code>
  141. This is a multi-line code example:
  142. <pre><code class="language-html">
  143. <table>
  144. <tr>
  145. <th>Name</th>
  146. <th>Side</th>
  147. <th>Role</th>
  148. <tr>
  149. <td>Darth</td>
  150. <td>Dark</td>
  151. <td>Sith</td>
  152. </tr>
  153. </table>
  154. </code></pre>
  155. 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):
  156. * __Frontend only__ - code snippets are escaped at runtime (no changes made to content in the database)
  157. * __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)
  158. * __Frontend &amp; Admin Area__ - both of the previous are applied
  159. * __None__ - all code escaping is disabled
  160. Note that each library &mdash; Prism.js, Highlight.js, and Plain Flavor &mdash; 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.
  161. When code escaping is enabled for either/both the frontend or Admin Area, the plugin makes the following changes to any code contained within &lt;code&gt;&lt;/code&gt; tags:
  162. \r removed
  163. & replaced with &amp;
  164. < replaced with &lt;
  165. > replaced with &gt;
  166. trailing whitespace removed
  167. These are the _only_ changes made to your code, no other changes are made.
  168. 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.
  169. __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.
  170. **About Prism.js**
  171. Prism.js version used in Prismatic plugin: __1.14.0__
  172. __Prism.js resources__
  173. * [Homepage](http://prismjs.com/)
  174. * [GitHub](https://github.com/PrismJS/prism)
  175. * [Changelog](https://github.com/PrismJS/prism/blob/gh-pages/CHANGELOG.md)
  176. __License &amp; Info__
  177. /*
  178. Prism: Lightweight, robust, elegant syntax highlighting
  179. MIT license http://www.opensource.org/licenses/mit-license.php/
  180. @author Lea Verou http://lea.verou.me
  181. */
  182. __Supported Languages__
  183. Language Class
  184. Apache = apacheconf
  185. AppleScript = applescript
  186. Bash = bash
  187. C = c
  188. C# = csharp
  189. C++ = cpp
  190. C-like = clike
  191. CoffeeScript = coffeescript
  192. CSS = css
  193. Diff = diff
  194. Git = git
  195. Go = go
  196. GraphQL = graphql
  197. Groovy = groovy
  198. HTTP = http
  199. Ini = ini
  200. Java = java
  201. JavaScript = javascript
  202. JSON = json
  203. Kotlin = kotlin
  204. LaTeX = latex
  205. Lua = lua
  206. Makefile = makefile
  207. Markdown = markdown
  208. Markup = markup
  209. NGINX = nginx
  210. Objective-C = objectivec
  211. Pascal = pascal
  212. Perl = perl
  213. PHP = php
  214. PowerShell = powershell
  215. Python = python
  216. Ruby = ruby
  217. SASS = sass
  218. SCSS = scss
  219. SQL = sql
  220. Swift = swift
  221. Twig = twig
  222. TypeScript = typescript
  223. Visual Basic = visual-basic
  224. YAML = yaml
  225. So for example, to specify a code block as C++, you would write:
  226. Single line: <code class="language-cpp">...</code>
  227. Multi-line: <pre><code class="language-cpp">...</code></pre>
  228. Alternate: <pre class="language-cpp"><code class="optional">...</code></pre>
  229. 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.
  230. To disable Prism.js syntax highlighting for any snippet, simply omit the language class.
  231. _I'm glad to add more languages, [make a suggestion](https://perishablepress.com/contact/)_
  232. **About Highlight.js**
  233. Highlight.js version used in Prismatic plugin: __9.12.0__
  234. __Highlight.js resources__
  235. * [Homepage](https://highlightjs.org/)
  236. * [GitHub](https://github.com/isagalaev/highlight.js)
  237. * [Changelog](https://github.com/isagalaev/highlight.js/blob/master/CHANGES.md)
  238. __License &amp; Info__
  239. /*
  240. Syntax highlighting with language autodetection.
  241. Copyright (c) 2006, Ivan Sagalaev https://highlightjs.org/
  242. All rights reserved. BSD3 License @ https://git.io/hljslicense
  243. */
  244. __Supported Languages__
  245. Language Class
  246. Apache = apache, apacheconf
  247. AppleScript = applescript, osascript
  248. Bash = bash, sh, zsh
  249. C# = cs, csharp
  250. C++ = cpp, c, cc, h, c++, h++, hpp
  251. CSS = css
  252. CoffeeScript = coffeescript, coffee, cson, iced
  253. Diff = diff, patch
  254. Go = go, golang
  255. Groovy = groovy
  256. HTML/XML = xml, html, xhtml, rss, atom, xjb, xsd, xsl, plist
  257. HTTP = http, https
  258. Ini = ini
  259. JSON = json
  260. Java = java, jsp
  261. JavaScript = javascript, js, jsx
  262. Kotlin = kotlin
  263. Lua = lua
  264. Makefile = makefile, mk, mak
  265. Markdown = markdown, md, mkdown, mkd
  266. Nginx = nginx, nginxconf
  267. Objective-C = objectivec, mm, objc, obj-c
  268. PHP = php, php3, php4, php5, php6
  269. Perl = perl, pl, pm
  270. PowerShell = powershell, ps
  271. Python = python, py, gyp
  272. Ruby = ruby, rb, gemspec, podspec, thor, irb
  273. Shell Session = shell
  274. SQL = sql
  275. Swift = swift
  276. TypeScript = typescript, ts
  277. So for example, to specify a code block as C++, you would write:
  278. Single line: <code class="language-cpp">...</code>
  279. Multi-line: <pre><code class="language-cpp">...</code></pre>
  280. Alternate: <pre class="language-cpp"><code class="optional">...</code></pre>
  281. 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.
  282. To disable Highlight.js syntax highlighting for any code block, add a class of `nohighlight`, like so:
  283. <code class="nohighlight">...</code>
  284. _I'm glad to add more languages, [make a suggestion](https://perishablepress.com/contact/)_
  285. == Upgrade Notice ==
  286. 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.
  287. __Note:__ uninstalling the plugin from the WP Plugins screen results in the removal of all settings from the WP database.
  288. == Frequently Asked Questions ==
  289. **Can you add another language for Prism.js or Highlight.js?**
  290. Yes, feel free to [suggest a language](https://perishablepress.com/contact/)
  291. **Does this work with Gutenberg Block Editor?**
  292. 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.
  293. 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.
  294. **Got a question?**
  295. Send any questions or feedback via my [contact form](https://perishablepress.com/contact/)
  296. == Support development of this plugin ==
  297. 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:
  298. * [The Tao of WordPress](https://wp-tao.com/)
  299. * [Digging into WordPress](https://digwp.com/)
  300. * [.htaccess made easy](https://htaccessbook.com/)
  301. * [WordPress Themes In Depth](https://wp-tao.com/wordpress-themes-book/)
  302. And/or purchase one of my premium WordPress plugins:
  303. * [BBQ Pro](https://plugin-planet.com/bbq-pro/) - Super fast WordPress firewall
  304. * [Blackhole Pro](https://plugin-planet.com/blackhole-pro/) - Automatically block bad bots
  305. * [Banhammer Pro](https://plugin-planet.com/banhammer-pro/) - Monitor traffic and ban the bad guys
  306. * [USP Pro](https://plugin-planet.com/usp-pro/) - Unlimited front-end forms
  307. Links, tweets and likes also appreciated. Thank you! :)
  308. == Changelog ==
  309. **1.8 (2018/11/14)**
  310. * Fixes bug: Invalid argument foreach() resources-enqueue.php line 267
  311. * Adds homepage link to Plugins screen
  312. * Updates default translation template
  313. * Tests on WordPress 5.0 (beta)
  314. **1.7 (2018/08/17)**
  315. * Adds `rel="noopener noreferrer"` to all [blank-target links](https://perishablepress.com/wordpress-blank-target-vulnerability/)
  316. * Updates GDPR blurb and donate link
  317. * Tweaks appearance of plugin settings page
  318. * Regenerates default translation template
  319. * Further tests on WP versions 4.9 and 5.0 (alpha)
  320. **1.6/1.6.1 (2018/05/07)**
  321. * Updates Prism.js from 1.11 to 1.14
  322. * Adds VBA `visual-basic` and Pascal `pascal`
  323. * Adds new Prism theme: "Tomorrow Night"
  324. * Improves support for Gutenberg Editor
  325. * Adds support for Go langauge (golang)
  326. * Updates Prism.js to version 1.11.0
  327. * Removes unused font file, `FontAwesome.otf`
  328. * Tests on WordPress 5.0 (alpha)
  329. **1.5 (2017/10/22)**
  330. * Adds "Requires PHP" to plugin file headers
  331. * Tests on WordPress 4.9
  332. **1.4 (2017/07/31)**
  333. * Fixes several PHP Warnings
  334. * Updates Highlight.js to version 9.12.0
  335. * Adds new languages for Highlight.js and Prism.js
  336. * Adds GPL license text file
  337. * Tests on WordPress 4.9 (alpha)
  338. **1.3 (2017/03/24)**
  339. * Updates some URLs to HTTPS
  340. * Updates Prism.js to version 1.6
  341. * Updates Highlight.js to version 9.11.0
  342. * Adds new languages for Highlight.js and Prism.js
  343. * Tweaks plugin settings styles
  344. * Replaces global `$wp_version` with `get_bloginfo('version')`
  345. * Tests on WordPress version 4.8
  346. **1.2 (2016/11/16)**
  347. * Adds support for AppleScript in Highlight.js
  348. * Updates plugin URL in core files and readme.txt
  349. * Changes stable tag from trunk to latest version
  350. * Adds `&raquo;` to rate this link on Plugins screen
  351. * Adds strong tags to admin notices on settings page
  352. * Refines styles for popup dialog on settings page
  353. * Tests on WordPress version 4.7 (beta)
  354. **1.1 (2016/10/24)**
  355. * Updates/adds some links
  356. * Updates default language file
  357. * Tests on WordPress version 4.7 (alpha)
  358. **1.0 (2016/10/21)**
  359. * Initial release