Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Themes
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

HTML Blocks

YinnoYinno112 downloads

Render live HTML, CSS and JavaScript directly in your notes with html-block code fences, each isolated in its own Shadow DOM.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates3

Render live HTML, CSS and JavaScript directly inside your Obsidian notes. Write an html-block code fence and it renders in place — no need to create separate .html files.

Each block renders inside its own Shadow DOM, so its styles are fully isolated from your theme and from other blocks. You can drop in self-contained widgets, diagrams, styled cards, small interactive demos, and they render exactly as written.

Usage

Write a fenced code block with the html-block language tag:

```html-block
<div style="padding: 16px; border-radius: 8px; background: #f0f4ff;">
  <h3>Hello from HTML Blocks</h3>
  <p>This renders as real HTML, isolated in its own Shadow DOM.</p>
</div>
```

CSS

Styles inside a block only affect that block. Use :root or :host to target the block container:

```html-block
<style>
  :host { font-family: system-ui; }
  .badge { background: #10b981; color: white; padding: 4px 10px; border-radius: 99px; }
</style>
<span class="badge">Isolated styling</span>
```

JavaScript

Inline <script> runs in an isolated scope. document.getElementById(...), querySelector(...) and friends resolve against the current block, so simple scripts work as you'd expect:

```html-block
<button id="btn">Clicked 0 times</button>
<script>
  let n = 0;
  const btn = document.getElementById('btn');
  btn.addEventListener('click', () => { btn.textContent = `Clicked ${++n} times`; });
</script>
```

Each block gets its own scope, so top-level variables in one block never collide with another.

Rendering an external file

You can keep HTML in a separate file and embed it:

![[my-widget.html]]

Inspect mode

Run the Toggle Inspect Mode command (bindable to a hotkey). While active, hovering over a rendered element scrolls the source to the matching line, and clicking selects it — handy for finding which line produced which element. Press Esc to exit.

Security model

This plugin executes the HTML, CSS and JavaScript you write in your own notes. That is the whole point of it — much like Dataview JS or Templater.

To keep that as safe as possible:

  • Only inline <script> is executed. External scripts (<script src="https://...">) are not fetched or run. The plugin never downloads or executes remote code.
  • Each block runs in an isolated Shadow DOM and its own function scope.

Only put HTML/JS you trust into your notes, the same way you would with any code you run.

Installation

From Community Plugins (once approved)

Settings → Community plugins → Browse → search HTML Blocks → Install → Enable.

Manual

  1. Download main.js, manifest.json and styles.css from the latest release.
  2. Copy them into <your-vault>/.obsidian/plugins/html-blocks/.
  3. Reload Obsidian and enable the plugin in Settings → Community plugins.

Support

If this plugin is useful to you, you can support development via GitHub Sponsors. Completely optional.

License

MIT © Yinno

HealthExcellent
ReviewCaution
About
Render live HTML, CSS, and JavaScript directly inside notes using fenced html-block code fences. Isolate each block in its own Shadow DOM so styles and top-level variables don't collide, embed external .html files, and use Inspect Mode to jump from rendered elements to their source.
HTMLCode
Details
Current version
1.0.2
Last updated
3 weeks ago
Created
3 weeks ago
Updates
3 releases
Downloads
112
Compatible with
Obsidian 1.7.2+
Platforms
Desktop, Mobile
License
MIT
Report bugRequest featureReport plugin
Sponsor
GitHub Sponsors
Author
YinnoYinnojwczju
GitHubjwczju
  1. Community
  2. Plugins
  3. HTML
  4. HTML Blocks

Related plugins

Mermaid Tools

Improved Mermaid.js experience: visual toolbar with common elements and more.

Templater

Create and use dynamic templates.

PlantUML

Generate PlantUML diagrams.

Kroki

Render Kroki diagrams.

Code Space

Professional code file management with visual dashboard, syntax highlighting editor, and Markdown embedding.

VSCode Editor

Edit Code Files like VSCode.

CustomJS

Reuse custom JavaScript across desktop and mobile.

JS Engine

Run JavaScript from within your notes.

Smart Chat

Integrate OpenAI's ChatGPT seamlessly in notes. Automatically saves links, allows marking threads as done, and integrates with Dataview.

Inline Encrypter

Encrypt secrets in your notes.