MediaWiki:Common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// Log the current script source and call stack for debugging
console.log("Current script source:", document.currentScript ? document.currentScript.src : "No current script available");
console.log("Call stack:", (new Error()).stack);
// Load highlight.js
importScriptURI('/skins/common/highlight.js');
// Check if highlight.js has been loaded properly
if (typeof hljs === "undefined") {
console.error("highlight.js is not loaded properly. Ensure the correct path to highlight.js is used.");
} else {
console.log("highlight.js is loaded successfully.");
// Attempt to highlight all code blocks
try {
if (typeof hljs.highlightAll === "function") {
hljs.highlightAll();
console.log("highlight.js executed successfully on all code blocks.");
} else {
console.error("highlight.js does not have the 'highlightAll' function. Check if the script is correct.");
}
} catch (e) {
console.error("Error highlighting code blocks: ", e);
}
}