Example 1: Pre-loaded Highlight.js with GitHub Dark Theme
Highlight.js is loaded before SquibView with GitHub Dark theme. The autoloader detects this and uses the existing instance.
<!-- Load highlight.js with custom theme before SquibView -->
<link rel="stylesheet" href=".../github-dark.min.css">
<script src=".../highlight.min.js"></script>
// SquibView will detect and use the pre-loaded library
const editor = new SquibView('#editor1', {
autoload_deps: { all: true } // Enable autoloading
});
Example 2: Custom CDN URLs & Disabled Libraries
Uses jsDelivr CDN for Mermaid instead of default CDN, and disables MathJax autoloading completely.
const editor = new SquibView('#editor2', {
autoload_deps: {
mathjax: false, // Disable MathJax
mermaid: 'ondemand', // Use on-demand loading
hljs: 'ondemand',
leaflet: 'ondemand',
three: 'ondemand',
cdnUrls: {
mermaid: {
script: 'https://cdn.jsdelivr.net/npm/mermaid@10/...'
}
}
}
});