@@ -18,7 +18,7 @@ You can add a plugin via the ``addPlugin`` API.
18
18
19
19
// or simply a keyed object of functions
20
20
addPlugin({
21
- 'after:highlightBlock ': ({ block , result, text }) => {
21
+ 'after:highlightElement ': ({ el , result, text }) => {
22
22
// ...
23
23
}
24
24
});
@@ -38,24 +38,24 @@ your class and execute it's callbacks as necessary.
38
38
self.prefix = options.dataPrefix;
39
39
}
40
40
41
- 'after:highlightBlock '({ block , result, text }) {
41
+ 'after:highlightElement '({ el , result, text }) {
42
42
// ...
43
43
}
44
44
}
45
45
46
46
hljs.addPlugin(new DataLanguagePlugin({ dataPrefix: 'hljs' }));
47
47
48
- Function based plugins
49
- ^^^^^^^^^^^^^^^^^^^^^
48
+ Function Based Plugins
49
+ ^^^^^^^^^^^^^^^^^^^^^^
50
50
51
51
This approach is best for simpler plugins.
52
52
53
53
::
54
54
55
55
hljs.addPlugin({
56
- 'after:highlightBlock ': ({ block , result }) => {
56
+ 'after:highlightElement ': ({ el , result }) => {
57
57
// move the language from the result into the dataset
58
- block .dataset.language = result.language;
58
+ el .dataset.language = result.language;
59
59
}
60
60
});
61
61
@@ -91,7 +91,7 @@ It returns nothing.
91
91
92
92
93
93
``after:highlight(result) ``
94
- ^^^^^^^^^^^^^^^^^^^^^^^
94
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
95
95
96
96
This callback function is passed the ``result `` object after highlighting is
97
97
complete. Your plugin may make any changes it desires to the result object
@@ -102,18 +102,18 @@ Note: This callback does not fire from highlighting resulting from auto-language
102
102
It returns nothing.
103
103
104
104
``after:highlightBlock({block, result, text}) ``
105
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106
106
107
107
Deprecated as of 10.7. Please use ``after:highlightElement ``.
108
108
109
109
``before:highlightBlock({block, language}) ``
110
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
111
111
112
112
Deprecated as of 10.7. Please use ``before:highlightElement ``.
113
113
114
114
115
115
``after:highlightElement({el, result, text}) ``
116
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
116
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117
117
118
118
This callback function is passed an object with two keys:
119
119
@@ -130,7 +130,7 @@ It returns nothing.
130
130
131
131
132
132
``before:highlightElement({el, language}) ``
133
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
133
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134
134
135
135
This callback function is passed an object with two keys:
136
136
0 commit comments