Complete reference for all configuration options available when creating a SquibView instance.
All options are passed as an object to the SquibView constructor:
const editor = newSquibView('#editor', {
// options here
});
Initial content to display in the editor.
string
''
initialContent: '# Welcome\n\nStart editing here...'
Type of the initial content and default content type for the editor.
string
'md'
'md'
, 'html'
, 'reveal'
, 'csv'
, 'tsv'
inputContentType: 'html'
Initial view mode for the editor.
string
'split'
'src'
, 'html'
, 'split'
initialView: 'src'// Start with source view only
Whether to display the control toolbar.
boolean
true
showControls: false// Hide all controls
Whether to display the title section above the editor.
boolean
false
titleShow: true,
titleContent: 'My Editor'
Content for the title section (only used if titleShow
is true).
string
''
titleShow: true,
titleContent: '<h2>Document Editor</h2>'
Base CSS class for styling the editor container.
string
'squibview'
baseClass: 'my-custom-editor'// Use custom CSS class
Whether to display line numbers in the source editor.
boolean
false
showLineNumbers: true
Starting line number (when line numbers are shown).
number
1
showLineNumbers: true,
lineNumberStart: 100// Start numbering from 100
Minimum number of digits for line numbers (adds leading zeros).
number
2
showLineNumbers: true,
lineNumberMinDigits: 3// Shows 001, 002, etc.
Whether to preserve HTML image tags when converting HTML to Markdown.
boolean
true
preserveImageTags: false// Convert <img> to 
Callback function for handling text replacement operations.
function(selectionData)
null
onReplaceSelectedText: (data) => {
console.log('Selected:', data.text);
// Return replacement text or handle replacementreturn data.text.toUpperCase();
}
Configuration for automatically loading external dependencies.
Object | null
null
(disabled){
all: boolean, // Enable all autoloadingstrategy: string, // 'auto', 'ondemand', or 'custom'libraries: {
mermaid: boolean | 'auto' | 'ondemand' | 'none',
hljs: boolean | 'auto' | 'ondemand' | 'none',
mathjax: boolean | 'auto' | 'ondemand' | 'none',
leaflet: boolean | 'auto' | 'ondemand' | 'none',
three: boolean | 'auto' | 'ondemand' | 'none'
},
cdnUrls: {
// Custom CDN URLs for each library
},
debug: boolean // Enable debug logging
}
autoload_deps: {
all: true// Load all dependencies automatically
}
autoload_deps: {
libraries: {
mermaid: 'auto', // Load at startuphljs: 'ondemand', // Load when neededmathjax: false// Never load
}
}
autoload_deps: {
all: true,
cdnUrls: {
mermaid: {
script: 'https://my-cdn.com/mermaid.min.js'
},
hljs: {
script: 'https://my-cdn.com/highlight.min.js',
css: 'https://my-cdn.com/highlight.css'
}
}
}
autoload_deps: {
strategy: 'ondemand', // Only load when content requires itdebug: true// Show loading messages
}
const editor = newSquibView('#editor', {
// ContentinitialContent: '# Welcome\n\nStart typing...',
inputContentType: 'md',
// DisplayinitialView: 'split',
showControls: true,
titleShow: true,
titleContent: 'My Document',
baseClass: 'my-editor',
// Line numbersshowLineNumbers: true,
lineNumberStart: 1,
lineNumberMinDigits: 2,
// ProcessingpreserveImageTags: true,
// EventsonReplaceSelectedText: (data) => {
returnprocessSelection(data);
},
// Dependenciesautoload_deps: {
strategy: 'ondemand',
libraries: {
mermaid: 'auto',
hljs: 'auto',
mathjax: 'ondemand'
}
}
});
{
initialContent: '',
inputContentType: 'md',
showControls: true,
titleShow: false,
titleContent: '',
initialView: 'split',
baseClass: 'squibview',
preserveImageTags: true,
showLineNumbers: false,
lineNumberStart: 1,
lineNumberMinDigits: 2,
onReplaceSelectedText: null,
autoload_deps: null
}