Skip to content

Commit

Permalink
Initial implementation of manual highlighting (#1087)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
mAAdhaTTah authored and LeaVerou committed Jan 24, 2017
1 parent a708730 commit bafc4cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/prism-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bafc4cb

Please sign in to comment.