Skip to content

Commit ecddb40

Browse files
committed
Bump version to 1.2.0, update readme and screenshots
1 parent 1ad8df7 commit ecddb40

File tree

5 files changed

+20
-38
lines changed

5 files changed

+20
-38
lines changed

readme.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,23 @@ Extending the Code block with syntax highlighting rendered on the server, thus b
88
**Tags:** [block](https://wordpress.org/plugins/tags/block), [code](https://wordpress.org/plugins/tags/code), [code syntax](https://wordpress.org/plugins/tags/code-syntax), [syntax highlight](https://wordpress.org/plugins/tags/syntax-highlight), [code highlighting](https://wordpress.org/plugins/tags/code-highlighting)
99
**Requires at least:** 5.2
1010
**Tested up to:** 5.4
11-
**Stable tag:** 1.1.4
11+
**Stable tag:** 1.2.0
1212
**License:** [GPLv2 or later](http://www.gnu.org/licenses/gpl-2.0.html)
1313
**Requires PHP:** 5.6
1414

1515
[![Build Status](https://travis-ci.org/westonruter/syntax-highlighting-code-block.svg?branch=master)](https://travis-ci.org/westonruter/syntax-highlighting-code-block) [![Built with Grunt](https://gruntjs.com/cdn/builtwith.svg)](http://gruntjs.com)
1616

1717
## Description ##
1818

19-
This plugin extends to Code block in WordPress core to add syntax highlighting which is rendered on the server. By performing the syntax highlighting on the server, there is then no need to enqueue any JavaScript on the frontend (e.g. Highlight.js or Prism.js) and this ensures there is no flash of unhighlighted code (FOUC?). Reducing script on the frontend improves frontend performance and it also allows for the syntax highlighted code to appear properly in AMP pages as rendered by the [official AMP plugin](https://amp-wp.org) (see also [ampproject/amp-wp#972](https://github.com/ampproject/amp-wp/issues/972)).
19+
This plugin extends the Code block in WordPress core to add syntax highlighting which is rendered on the server. Pre-existing Code blocks on a site are automatically extended to include syntax highlighting. Doing server-side syntax highlighting eliminates the need to enqueue any JavaScript on the frontend (e.g. Highlight.js or Prism.js) and this ensures there is no flash of unhighlighted code (FOUC?). Reducing script on the frontend improves frontend performance and it also allows for the syntax highlighted code to appear properly in AMP pages as rendered by the [official AMP plugin](https://amp-wp.org) (see also [ampproject/amp-wp#972](https://github.com/ampproject/amp-wp/issues/972)) or when JavaScript is turned off in the browser.
2020

21-
The extended Code block uses auto-detection for the language in the block to add syntax highlighting, but you can override the language in the block inspector. (There is currently no syntax highlighting of the Code block in the editor.) The plugin supports for all [185 programming languages](https://highlightjs.org/static/demo/) that [highlight.php](https://github.com/scrivo/highlight.php) supports (being a port of [highlight.js](https://highlightjs.org/)).
21+
In addition to not adding any JavaScript to the frontend, the stylesheets needed for styling the Code block will only be added to the page if there is a Code block present. The stylesheets are added inline when the Code block is rendered, ensuring that they do not block rendering of any content higher in the page. If stylesheets fail to load for any reason, the block simply renders without styling, with one key exception: highlighted lines are wrapped in [`mark` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark) so they'll get highlighted regardless, including in RSS Feeds and posts syndicated in email (as long as the `mark` element is supported in the client).
2222

23-
Any one of [89 styles](https://highlightjs.org/static/demo/) may be enqueued that highlight.php/highlight.js provide. To change the `default` style, you may do so by picking a theme via Customizer in the Colors section. To override the `default` style programmatically, use the `syntax_highlighting_code_block_style` to supply the one of the [style names](https://github.com/scrivo/highlight.php/tree/master/styles), for example `github`:
23+
This extended Code block uses language auto-detection to add syntax highlighting, but you can override the language in the block's settings sidebar. (There is currently no syntax highlighting of the Code block in the editor.) The plugin supports all [programming languages](https://highlightjs.org/static/demo/) that [highlight.php](https://github.com/scrivo/highlight.php) supports (being a port of [highlight.js](https://highlightjs.org/)). The Code block also is extended to support specifying the aforementioned highlighted lines. There is also a checkbox for whether to show line numbers on the frontend (with the numbers being non-selectable). Lastly, given inconsistencies across themes as to whether lines in a Code block should be wrapped, this plugin adds styling to force them to no-wrap by default, with a checkbox to opt-in to wrapping when desired.
2424

25-
<pre lang=php>
26-
add_filter(
27-
'syntax_highlighting_code_block_style',
28-
function() {
29-
return 'github';
30-
}
31-
);
32-
</pre>
25+
For advanced usage, please see the [plugin wiki](https://github.com/westonruter/syntax-highlighting-code-block/wiki).
3326

34-
When a filter is provided, the theme selector in Customizer is automatically disabled.
35-
36-
This plugin is [developed on GitHub](https://github.com/westonruter/syntax-highlighting-code-block). See [list of current issues](https://github.com/westonruter/syntax-highlighting-code-block/issues) with the plugin. Please feel free to file any additional issues or requests that you may come across. [Pull requests](https://github.com/westonruter/syntax-highlighting-code-block/pulls) are welcome to help extend.
27+
This plugin is [developed on GitHub](https://github.com/westonruter/syntax-highlighting-code-block). See [list of current issues](https://github.com/westonruter/syntax-highlighting-code-block/issues) with the plugin. Please feel free to file any additional issues or requests that you may come across. [Pull requests](https://github.com/westonruter/syntax-highlighting-code-block/pulls) are welcome.
3728
### Credits ###
3829
This is a fork of [Code Syntax Block](https://github.com/mkaz/code-syntax-block) by [Marcus Kazmierczak](https://mkaz.blog/) (mkaz), which is also [available on WordPress.org](https://wordpress.org/plugins/code-syntax-block/). Copyright (c) 2018 Marcus Kazmierczak. Licensed under GPL 2.0 or later.
3930

@@ -42,13 +33,13 @@ This is a fork of [Code Syntax Block](https://github.com/mkaz/code-syntax-block)
4233

4334
## Screenshots ##
4435

45-
### Supply content as you do normally in the Code block, optionally overriding the auto-detected language.
36+
### Code blocks can be added as normal, optionally overriding the auto-detected language. Also specify any lines to be highlighted, whether to show line numbers, and if the lines should wrap.
4637

47-
![Supply content as you do normally in the Code block, optionally overriding the auto-detected language.](wp-assets/screenshot-1.png)
38+
![Code blocks can be added as normal, optionally overriding the auto-detected language. Also specify any lines to be highlighted, whether to show line numbers, and if the lines should wrap.](wp-assets/screenshot-1.png)
4839

49-
### The Code block renders with syntax highlighting on the frontend without any JavaScript enqueued.
40+
### The Code block renders with syntax highlighting on the frontend without any JavaScript enqueued. Stylesheets are added only when block is on the page.
5041

51-
![The Code block renders with syntax highlighting on the frontend without any JavaScript enqueued.](wp-assets/screenshot-2.png)
42+
![The Code block renders with syntax highlighting on the frontend without any JavaScript enqueued. Stylesheets are added only when block is on the page.](wp-assets/screenshot-2.png)
5243

5344
## Changelog ##
5445

readme.txt

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: westonruter, allejo
33
Tags: block, code, code syntax, syntax highlight, code highlighting
44
Requires at least: 5.2
55
Tested up to: 5.4
6-
Stable tag: 1.1.4
6+
Stable tag: 1.2.0
77
License: GPLv2 or later
88
License URI: http://www.gnu.org/licenses/gpl-2.0.html
99
Requires PHP: 5.6
@@ -12,24 +12,15 @@ Extending the Code block with syntax highlighting rendered on the server, thus b
1212

1313
== Description ==
1414

15-
This plugin extends to Code block in WordPress core to add syntax highlighting which is rendered on the server. By performing the syntax highlighting on the server, there is then no need to enqueue any JavaScript on the frontend (e.g. Highlight.js or Prism.js) and this ensures there is no flash of unhighlighted code (FOUC?). Reducing script on the frontend improves frontend performance and it also allows for the syntax highlighted code to appear properly in AMP pages as rendered by the [official AMP plugin](https://amp-wp.org) (see also [ampproject/amp-wp#972](https://github.com/ampproject/amp-wp/issues/972)).
15+
This plugin extends the Code block in WordPress core to add syntax highlighting which is rendered on the server. Pre-existing Code blocks on a site are automatically extended to include syntax highlighting. Doing server-side syntax highlighting eliminates the need to enqueue any JavaScript on the frontend (e.g. Highlight.js or Prism.js) and this ensures there is no flash of unhighlighted code (FOUC?). Reducing script on the frontend improves frontend performance and it also allows for the syntax highlighted code to appear properly in AMP pages as rendered by the [official AMP plugin](https://amp-wp.org) (see also [ampproject/amp-wp#972](https://github.com/ampproject/amp-wp/issues/972)) or when JavaScript is turned off in the browser.
1616

17-
The extended Code block uses auto-detection for the language in the block to add syntax highlighting, but you can override the language in the block inspector. (There is currently no syntax highlighting of the Code block in the editor.) The plugin supports for all [185 programming languages](https://highlightjs.org/static/demo/) that [highlight.php](https://github.com/scrivo/highlight.php) supports (being a port of [highlight.js](https://highlightjs.org/)).
17+
In addition to not adding any JavaScript to the frontend, the stylesheets needed for styling the Code block will only be added to the page if there is a Code block present. The stylesheets are added inline when the Code block is rendered, ensuring that they do not block rendering of any content higher in the page. If stylesheets fail to load for any reason, the block simply renders without styling, with one key exception: highlighted lines are wrapped in [`mark` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark) so they'll get highlighted regardless, including in RSS Feeds and posts syndicated in email (as long as the `mark` element is supported in the client).
1818

19-
Any one of [89 styles](https://highlightjs.org/static/demo/) may be enqueued that highlight.php/highlight.js provide. To change the `default` style, you may do so by picking a theme via Customizer in the Colors section. To override the `default` style programmatically, use the `syntax_highlighting_code_block_style` to supply the one of the [style names](https://github.com/scrivo/highlight.php/tree/master/styles), for example `github`:
19+
This extended Code block uses language auto-detection to add syntax highlighting, but you can override the language in the block's settings sidebar. (There is currently no syntax highlighting of the Code block in the editor.) The plugin supports all [programming languages](https://highlightjs.org/static/demo/) that [highlight.php](https://github.com/scrivo/highlight.php) supports (being a port of [highlight.js](https://highlightjs.org/)). The Code block also is extended to support specifying the aforementioned highlighted lines. There is also a checkbox for whether to show line numbers on the frontend (with the numbers being non-selectable). Lastly, given inconsistencies across themes as to whether lines in a Code block should be wrapped, this plugin adds styling to force them to no-wrap by default, with a checkbox to opt-in to wrapping when desired.
2020

21-
<pre lang=php>
22-
add_filter(
23-
'syntax_highlighting_code_block_style',
24-
function() {
25-
return 'github';
26-
}
27-
);
28-
</pre>
21+
For advanced usage, please see the [plugin wiki](https://github.com/westonruter/syntax-highlighting-code-block/wiki).
2922

30-
When a filter is provided, the theme selector in Customizer is automatically disabled.
31-
32-
This plugin is [developed on GitHub](https://github.com/westonruter/syntax-highlighting-code-block). See [list of current issues](https://github.com/westonruter/syntax-highlighting-code-block/issues) with the plugin. Please feel free to file any additional issues or requests that you may come across. [Pull requests](https://github.com/westonruter/syntax-highlighting-code-block/pulls) are welcome to help extend.
23+
This plugin is [developed on GitHub](https://github.com/westonruter/syntax-highlighting-code-block). See [list of current issues](https://github.com/westonruter/syntax-highlighting-code-block/issues) with the plugin. Please feel free to file any additional issues or requests that you may come across. [Pull requests](https://github.com/westonruter/syntax-highlighting-code-block/pulls) are welcome.
3324

3425
= Credits =
3526

@@ -39,8 +30,8 @@ This is a fork of [Code Syntax Block](https://github.com/mkaz/code-syntax-block)
3930

4031
== Screenshots ==
4132

42-
1. Supply content as you do normally in the Code block, optionally overriding the auto-detected language.
43-
2. The Code block renders with syntax highlighting on the frontend without any JavaScript enqueued.
33+
1. Code blocks can be added as normal, optionally overriding the auto-detected language. Also specify any lines to be highlighted, whether to show line numbers, and if the lines should wrap.
34+
2. The Code block renders with syntax highlighting on the frontend without any JavaScript enqueued. Stylesheets are added only when block is on the page.
4435

4536
== Changelog ==
4637

syntax-highlighting-code-block.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Syntax-highlighting Code Block (with Server-side Rendering)
44
* Plugin URI: https://github.com/westonruter/syntax-highlighting-code-block
55
* Description: Extending the Code block with syntax highlighting rendered on the server, thus being AMP-compatible and having faster frontend performance.
6-
* Version: 1.2-beta2
6+
* Version: 1.2.0
77
* Author: Weston Ruter
88
* Author URI: https://weston.ruter.net/
99
* License: GPL2
@@ -22,7 +22,7 @@
2222
use WP_Customize_Manager;
2323
use WP_Styles;
2424

25-
const PLUGIN_VERSION = '1.2-beta2';
25+
const PLUGIN_VERSION = '1.2.0';
2626

2727
const BLOCK_NAME = 'core/code';
2828

wp-assets/screenshot-1.png

-256 KB
Loading

wp-assets/screenshot-2.png

-47.2 KB
Loading

0 commit comments

Comments
 (0)