forked from westonruter/syntax-highlighting-code-block
-
Notifications
You must be signed in to change notification settings - Fork 0
/
syntax-highlighting-code-block.php
72 lines (52 loc) · 1.98 KB
/
syntax-highlighting-code-block.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* Plugin Name: Syntax-highlighting Code Block (with Server-side Rendering)
* Plugin URI: https://github.com/westonruter/syntax-highlighting-code-block
* Description: Extending the Code block with syntax highlighting rendered on the server, thus being AMP-compatible and having faster frontend performance.
* Version: 1.5.1-alpha
* Author: Weston Ruter
* Author URI: https://weston.ruter.net/
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: syntax-highlighting-code-block
* Requires PHP: 7.4
*
* @package Syntax_Highlighting_Code_Block
*/
namespace Syntax_Highlighting_Code_Block;
const PLUGIN_VERSION = '1.5.1-alpha';
const PLUGIN_MAIN_FILE = __FILE__;
const PLUGIN_DIR = __DIR__;
const BLOCK_NAME = 'core/code';
const DEVELOPMENT_MODE = true; // This is automatically rewritten to false during dist build.
const OPTION_NAME = 'syntax_highlighting';
const DEFAULT_THEME = 'default';
const DEFAULT_HIGHLIGHTED_COLOR = '#ddf6ff';
const BLOCK_STYLE_FILTER = 'syntax_highlighting_code_block_style';
const HIGHLIGHTED_LINE_BACKGROUND_COLOR_FILTER = 'syntax_highlighted_line_background_color';
const THEME_STYLE_HANDLE = 'syntax-highlighting-code-block-theme';
const BLOCK_STYLE_HANDLE = 'syntax-highlighting-code-block';
const STYLE_HANDLES = [ THEME_STYLE_HANDLE, BLOCK_STYLE_HANDLE ];
const REST_API_NAMESPACE = 'syntax-highlighting-code-block/v1';
const EDITOR_SCRIPT_HANDLE = 'syntax-highlighting-code-block-scripts';
const EDITOR_STYLE_HANDLE = 'syntax-highlighting-code-block-styles';
const ATTRIBUTE_SCHEMA = [
'language' => [
'type' => 'string',
'default' => '',
],
'highlightedLines' => [
'type' => 'string',
'default' => '',
],
'showLineNumbers' => [
'type' => 'boolean',
'default' => false,
],
'wrapLines' => [
'type' => 'boolean',
'default' => false,
],
];
require_once __DIR__ . '/inc/functions.php';
add_action( 'plugins_loaded', __NAMESPACE__ . '\boot' );