Jump to content

MediaWiki:Common.css: Difference between revisions

From Knowledge Base
No edit summary
No edit summary
Line 1: Line 1:
// Load Prism.js (ensure correct path)
// Load Prism.js (ensure correct path)
importScriptURI('/prism.js'); // Adjust if necessary
importScriptURI('/prism.js'); // Adjust if necessary
 
// Load Prism.css (ensure correct path)
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '/prism.css';  // Adjust if necessary
document.head.appendChild(link);


// Optional: log to check if Prism.js is loaded
// Optional: log to check if Prism.js is loaded

Revision as of 10:44, 18 January 2025

// Load Prism.js (ensure correct path)
importScriptURI('/prism.js');  // Adjust if necessary

// Load Prism.css (ensure correct path)
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '/prism.css';  // Adjust if necessary
document.head.appendChild(link);

// Optional: log to check if Prism.js is loaded
if (typeof Prism !== "undefined") {
    console.log("Prism.js loaded successfully.");
} else {
    console.error("Prism.js is not loaded.");
}

// Initialize syntax highlighting after page load
$(document).ready(function() {
    if (typeof Prism !== "undefined") {
        Prism.highlightAll();
        console.log("Prism.js executed successfully on all code blocks.");
    } else {
        console.error("Prism.js not found when trying to highlight code.");
    }
});