An Obsidian plugin that lets you edit the text inside HTML blocks directly in Live Preview — just click the text and start typing.
- Click to edit — click any text inside an HTML block to open an editor
- Enter to save / Esc to cancel — familiar keyboard shortcuts
- Auto-cleanup — cursor leaving the source range restores the rendered view
- DOM ↔ source mapping — DOM node indexes align to source positions, supporting nested and repeated text
- Dark theme — adapts to Obsidian's native dark mode
When you embed complex HTML layouts in Markdown (flowcharts, cards, tables, …) and frequently tweak their text:
- Open a document containing a
<div>…</div>block - Click the text you want to change
- Edit it in the popover
Enterto save,Escto cancel
The block below is rendered by the plugin in Obsidian as a clickable card:
Paste it into a Live Preview note and click the sentence to edit it.
The plugin offers two complementary editing paths in Live Preview:
- Native HTML embed click-editing — instead of competing with Obsidian's native
.cm-html-embed.cm-embed-blockwidget, aViewPluginlistens for clicks during the capture phase.caretRangeFromPoint()+view.posAtCoords()map the click back to a Markdown source position, the popover edits it, and the result is written back viaview.dispatch({ changes }). - Widget inline editing — larger HTML blocks are rendered with
Decoration.replaceas an interactive widget; hovering reveals a toolbar, and clicking text inside it enters inline-edit mode.
All rendered HTML passes through Obsidian's built-in sanitizeHTMLToDom (DOMPurify-backed) before being inserted.
- Obsidian: 1.5.0+
- Platform: desktop only (
isDesktopOnly). Click-to-edit relies oncaretRangeFromPoint, which is unreliable on mobile WebViews. - Modes:
- ✅ Live Preview (recommended)
- Reading (read-only display)
After submission to the Obsidian Plugin Directory, search for HTML Live Editor under Settings → Community Plugins.
- Clone and build:
git clone https://github.com/elijahchan2019/plugin-html_live_editor.git cd plugin-html_live_editor npm install npm run build - Copy
manifest.json,main.js, andstyles.cssinto your vault's.obsidian/plugins/html-live-editor/directory - Restart Obsidian
- Enable HTML Live Editor under Settings → Community Plugins
- Named entities:
>/&/<edit correctly; named entities like©/—/ may cause source-position drift. - Large blocks: HTML blocks > 5000 characters are not heavily optimized.
- Deep nesting: very deeply nested HTML (> 10 levels) may reduce mapping accuracy.
For bugs or feature requests, please open an Issue.
MIT License
Made by Elijah