Skip to content

Commit 13adf5c

Browse files
committed
(chore) update plugin API docs
1 parent e637c7b commit 13adf5c

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

docs/plugin-api.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ You can add a plugin via the ``addPlugin`` API.
1818

1919
// or simply a keyed object of functions
2020
addPlugin({
21-
'after:highlightBlock': ({ block, result, text }) => {
21+
'after:highlightElement': ({ el, result, text }) => {
2222
// ...
2323
}
2424
});
@@ -38,24 +38,24 @@ your class and execute it's callbacks as necessary.
3838
self.prefix = options.dataPrefix;
3939
}
4040

41-
'after:highlightBlock'({ block, result, text }) {
41+
'after:highlightElement'({ el, result, text }) {
4242
// ...
4343
}
4444
}
4545

4646
hljs.addPlugin(new DataLanguagePlugin({ dataPrefix: 'hljs' }));
4747

48-
Function based plugins
49-
^^^^^^^^^^^^^^^^^^^^^
48+
Function Based Plugins
49+
^^^^^^^^^^^^^^^^^^^^^^
5050

5151
This approach is best for simpler plugins.
5252

5353
::
5454

5555
hljs.addPlugin({
56-
'after:highlightBlock': ({ block, result }) => {
56+
'after:highlightElement': ({ el, result }) => {
5757
// move the language from the result into the dataset
58-
block.dataset.language = result.language;
58+
el.dataset.language = result.language;
5959
}
6060
});
6161

@@ -91,7 +91,7 @@ It returns nothing.
9191

9292

9393
``after:highlight(result)``
94-
^^^^^^^^^^^^^^^^^^^^^^^
94+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
9595

9696
This callback function is passed the ``result`` object after highlighting is
9797
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
102102
It returns nothing.
103103

104104
``after:highlightBlock({block, result, text})``
105-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106106

107107
Deprecated as of 10.7. Please use ``after:highlightElement``.
108108

109109
``before:highlightBlock({block, language})``
110-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
111111

112112
Deprecated as of 10.7. Please use ``before:highlightElement``.
113113

114114

115115
``after:highlightElement({el, result, text})``
116-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
116+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117117

118118
This callback function is passed an object with two keys:
119119

@@ -130,7 +130,7 @@ It returns nothing.
130130

131131

132132
``before:highlightElement({el, language})``
133-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
133+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134134

135135
This callback function is passed an object with two keys:
136136

docs/plugin-recipes.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ via CSS with ``:before``, etc.
1717
::
1818

1919
hljs.addPlugin( {
20-
afterHighlightBlock: ({block, result}) => {
20+
'after:highlightElement': ({el, result}) => {
2121
// move the language from the result into the dataset
22-
block.dataset.language = result.language }
22+
el.dataset.language = result.language }
2323
})
2424

2525

0 commit comments

Comments
 (0)