(function() { if ( !self.Prism || !self.document || !document.querySelectorAll || ![].filter) return; var adapters = []; function registerAdapter(adapter) { if (typeof adapter === "function" && !getAdapter(adapter)) { adapters.push(adapter); } } function getAdapter(adapter) { if (typeof adapter === "function") { return adapters.filter(function(fn) { return fn.valueOf() === adapter.valueOf()})[0]; } else if (typeof adapter === "string" && adapter.length > 0) { return adapters.filter(function(fn) { return fn.name === adapter})[0]; } return null; } function removeAdapter(adapter) { if (typeof adapter === "string") adapter = getAdapter(adapter); if (typeof adapter === "function") { var index = adapters.indexOf(adapter); if (index >=0) { adapters.splice(index,1); } } } Prism.plugins.jsonphighlight = { registerAdapter: registerAdapter, removeAdapter: removeAdapter, highlight: highlight }; registerAdapter(function github(rsp, el) { if ( rsp && rsp.meta && rsp.data ) { if ( rsp.meta.status && rsp.meta.status >= 400 ) { return "Error: " + ( rsp.data.message || rsp.meta.status ); } else if ( typeof(rsp.data.content) === "string" ) { return typeof(atob) === "function" ? atob(rsp.data.content.replace(/\s/g, "")) : "Your browser cannot decode base64"; } } return null; }); registerAdapter(function gist(rsp, el) { if ( rsp && rsp.meta && rsp.data && rsp.data.files ) { if ( rsp.meta.status && rsp.meta.status >= 400 ) { return "Error: " + ( rsp.data.message || rsp.meta.status ); } else { var filename = el.getAttribute("data-filename"); if (filename == null) { // Maybe in the future we can somehow render all files // But the standard