q quikdown examples editor headless mode

Headless Mode

Drive the editor with your own UI via its public API. The toolbar is just optional sugar — the same actions work from any button, keyboard shortcut, or programmatic call.

Why headless? Integrate the editor into your own app shell, style buttons to match your design, place controls anywhere on the page, or expose only the actions you want. The public API (undo(), removeHR(), setMode(), etc.) does all the work.

1. Headless (custom toolbar)

Custom toolbar styled by the app — editor initialized with showToolbar: false

ready

2. Built-in toolbar

Same editor, stock toolbar — showToolbar: true + feature flags

Public API Reference

MethodDescription
setMarkdown(md)Replace current content (async)
getMarkdown()Get current markdown source
getHTML()Get rendered HTML
setMode(mode)Switch to 'source' | 'split' | 'preview'
setTheme(theme)Runtime theme: 'light' | 'dark' | 'auto'
undo() / redo()Step through edit history
canUndo() / canRedo()Check if undo/redo is available
clearHistory()Clear undo/redo stacks
removeHR()Strip all --- (fence-safe, table-safe)
convertLazyLinefeeds()Single \n → paragraph breaks (idempotent)
copy('markdown' | 'html')Copy to clipboard
copyRendered()Copy rendered rich text
destroy()Clean up the editor
QuikdownEditor.removeHRFromMarkdown(md)Static: strip HRs from a string
QuikdownEditor.convertLazyLinefeeds(md)Static: fix lazy linefeeds in a string