Skip to content

Commit bafc4cb

Browse files
mAAdhaTTahLeaVerou
authored andcommitted
Initial implementation of manual highlighting (#1087)
* Initial implementation of manual highlighting Borrow the `manual` property of whatever already existing Prism instance there is. * Simplify setting of `Prism.manual` Cleans up the implementation w/ less code.
1 parent a708730 commit bafc4cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/prism-core.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var lang = /\blang(?:uage)?-(\w+)\b/i;
1919
var uniqueId = 0;
2020

2121
var _ = _self.Prism = {
22+
manual: _self.Prism && _self.Prism.manual,
2223
util: {
2324
encode: function (tokens) {
2425
if (tokens instanceof Token) {
@@ -483,7 +484,7 @@ var script = document.currentScript || [].slice.call(document.getElementsByTagNa
483484
if (script) {
484485
_.filename = script.src;
485486

486-
if (document.addEventListener && !script.hasAttribute('data-manual')) {
487+
if (document.addEventListener && !_.manual && !script.hasAttribute('data-manual')) {
487488
if(document.readyState !== "loading") {
488489
if (window.requestAnimationFrame) {
489490
window.requestAnimationFrame(_.highlightAll);

0 commit comments

Comments
 (0)