From bafc4cb6a3c2f00f089b0d0297a9058458bdebf6 Mon Sep 17 00:00:00 2001 From: James DiGioia Date: Tue, 24 Jan 2017 16:31:10 -0500 Subject: [PATCH] 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. --- components/prism-core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/prism-core.js b/components/prism-core.js index a5335da9e5..2066bd59f5 100644 --- a/components/prism-core.js +++ b/components/prism-core.js @@ -19,6 +19,7 @@ var lang = /\blang(?:uage)?-(\w+)\b/i; var uniqueId = 0; var _ = _self.Prism = { + manual: _self.Prism && _self.Prism.manual, util: { encode: function (tokens) { if (tokens instanceof Token) { @@ -483,7 +484,7 @@ var script = document.currentScript || [].slice.call(document.getElementsByTagNa if (script) { _.filename = script.src; - if (document.addEventListener && !script.hasAttribute('data-manual')) { + if (document.addEventListener && !_.manual && !script.hasAttribute('data-manual')) { if(document.readyState !== "loading") { if (window.requestAnimationFrame) { window.requestAnimationFrame(_.highlightAll);