You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently trying to integrate the autoloader plugin in my project using Prism.js. I have downloaded the source code from the Prism.js download page, which includes the autoloader plugin.
Here is the TypeScript function I am using to highlight code:
import'prismjs/themes/prism.min.css';import*asPrismfrom'prismjs';constBASE_PRISM_PATH='https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/';functionhighlightedCode(code: string,language: string){if(code===null||code===undefined){thrownewError('Code is null or undefined');}if(typeofcode!=='string'){thrownewError('Code is not a string');}constprismLanguage=Prism.languages[language];if(!prismLanguage){console.log("Language not found, falling back to 'markup'");// I want to use autoLoader here! how?}returnPrism.highlight(code,prismLanguage,language);}
I would like to enable the autoloader to dynamically load languages when the specified language is not available. I tried configuring it using the following lines, but I'm not sure how to properly set it up:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am currently trying to integrate the autoloader plugin in my project using Prism.js. I have downloaded the source code from the Prism.js download page, which includes the autoloader plugin.
Here is the TypeScript function I am using to highlight code:
I would like to enable the autoloader to dynamically load languages when the specified language is not available. I tried configuring it using the following lines, but I'm not sure how to properly set it up:
Could you provide guidance on how to properly integrate the autoloader with Prism.js, especially within the context of this TypeScript setup?
Thank you for your help!
Beta Was this translation helpful? Give feedback.
All reactions