|
5 | 5 | Two highlighting modes: |
6 | 6 |
|
7 | 7 | - **Client-side** (default): Prism.js runs in the browser. Loads the Prism JS bundle + theme CSS. |
8 | | -- **Server-side**: highlight.php pre-renders token spans on the server. No JS loaded. Uses the same Prism theme CSS — token class remapping (`remap_token_classes()` in `class-blocks.php`) converts hljs-* span classes to Prism `token *` classes via `strtr`, giving exact visual parity across all 21 themes. |
| 8 | +- **Server-side**: highlight.php pre-renders token spans on the server. Loads only `hljs-clipboard.js` for the copy-to-clipboard and expand/collapse toolbar buttons (no Prism JS). Uses the same Prism theme CSS — token class remapping (`remap_token_classes()` in `class-blocks.php`) converts hljs-* span classes to Prism `token *` classes via `strtr`, giving exact visual parity across all 21 themes. |
9 | 9 |
|
10 | 10 | ## Commands |
11 | 11 |
|
@@ -35,7 +35,7 @@ Key files: |
35 | 35 |
|
36 | 36 | - `includes/class-main.php` — bootstrap and object wiring |
37 | 37 | - `includes/frontend/class-blocks.php` — editor assets, REST route, `render_block_core/code` filter; `render_code_block_server()` for server mode; `remap_token_classes()` for hljs→Prism class mapping |
38 | | -- `includes/frontend/class-styles-handler.php` — conditional asset loading for both modes: client (Prism JS + theme CSS) and server (theme CSS + `hljs-server-mode.css`, no JS) |
| 38 | +- `includes/frontend/class-styles-handler.php` — conditional asset loading for both modes: client (Prism JS + theme CSS) and server (theme CSS + `hljs-server-mode.css` + `hljs-clipboard.js`) |
39 | 39 | - `includes/admin/class-settings.php` — settings registration; `get_color_scheme_css()` always returns Prism CSS URL (no per-mode branch) |
40 | 40 | - `includes/blocks/src/js/index.js` — block filter, Inspector Controls |
41 | 41 | - `includes/blocks/src/js/frontend.js` — Prism grammars + plugins |
@@ -67,7 +67,7 @@ Always `require` the generated `.asset.php` manifest before enqueueing block scr |
67 | 67 | Assets load only on pages containing at least one `core/code` block (`Styles_Handler::enqueue_assets()`). Use `wzcbh_force_load_assets` to override. |
68 | 68 |
|
69 | 69 | - **Client mode**: `frontend.css` + Prism theme CSS + `wzcbh-prism-js` script bundle |
70 | | -- **Server mode**: `frontend.css` + Prism theme CSS + `hljs-server-mode.css` (no JS; syntax already pre-rendered in HTML) |
| 70 | +- **Server mode**: `frontend.css` + Prism theme CSS + `hljs-server-mode.css` + `hljs-clipboard.js` (syntax pre-rendered in HTML; `hljs-clipboard.js` provides copy-to-clipboard and expand/collapse only, no Prism) |
71 | 71 |
|
72 | 72 | ## Filters and routes |
73 | 73 |
|
|
0 commit comments