Mounib Bouchareb241 downloadsRender HTML code blocks as live, sandboxed webpages inside your notes.
HTML Preview is an Obsidian plugin that renders html-preview code blocks as interactive webpages directly inside notes.
Create a fenced code block with the language html-preview:
```html-preview
<!doctype html>
<html>
<head>
<style>
button {
padding: 0.5rem 1rem;
}
</style>
</head>
<body>
<button onclick="this.textContent = 'Clicked'">Click me</button>
</body>
</html>
```
The preview toolbar provides refresh, fullscreen, copy, and sizing controls. In manual sizing mode, drag the handle below the preview to change its height.
Use HTML Preview: Refresh all previews from the command palette to reload every mounted preview.
Preview code runs with the iframe sandbox permissions allow-scripts allow-forms. It does not receive same-origin access to Obsidian, popup permission, or direct access to the vault through this plugin.
HTML can still make external network requests through normal browser APIs. Only run code you understand, especially when opening notes from untrusted sources.
Strict isolation means previews cannot directly access Obsidian APIs, the host document, or local vault resources that require same-origin access.
Once listed in the Obsidian community plugin directory:
main.js, manifest.json, and styles.css from the latest GitHub release.<vault>/.obsidian/plugins/html-preview/.Requirements:
Install dependencies and run the full quality gate:
npm ci
npm run check
Useful commands:
npm run dev # rebuild on source changes
npm run typecheck # TypeScript validation
npm test # regression tests
npm run build # production main.js
The production plugin consists of main.js, manifest.json, and styles.css. Source files and tests are included in this repository for review and maintenance.
npm version patch, npm version minor, or npm version major.Git tags must use the exact version number without a v prefix, for example 1.0.1.