Markdown Explorer Blog

Preview HTML Files in Safe and Trusted Modes

2 min read

Preview HTML Files in Safe and Trusted Modes

Markdown projects often contain landing pages, exported examples, or small HTML prototypes. Markdown Explorer opens .html and .htm files from the Explorer, Quick Open, or workspace search.

Safe Preview is the default

Safe Preview renders the document in an isolated frame or native web view. JavaScript is blocked by default, along with capabilities such as popups, downloads, form submission, and navigation of the parent application.

Use this mode to inspect unfamiliar HTML:

<!doctype html> <html lang="en"> <body> <h1>Release notes</h1> <img src="./img/cover.png" alt="Release cover" /> </body> </html>

Relative images, linked CSS, SVG, fonts, and CSS url(...) resources are resolved from the workspace when available. Missing resources appear in the Preview diagnostics instead of failing silently.

Trusted Preview

Enable Trusted Preview only when you understand and trust the current workspace. It permits scripts for that workspace while maintaining an isolated origin without access to Markdown Explorer authentication storage or local file APIs.

Trusted Preview is useful for a local interactive example:

<button id="counter">Clicks: 0</button> <script> let clicks = 0 document.querySelector('#counter').addEventListener('click', event => { clicks += 1 event.currentTarget.textContent = `Clicks: ${clicks}` }) </script>

The trust choice is stored per workspace and can be revoked from the Preview status bar.

Read the diagnostics

The Preview reports missing local resources, JavaScript errors, and unhandled Promise errors. Fix these before assuming the page will behave correctly when published.

Safe Preview reduces risk but is not a malware-analysis sandbox. Do not grant Trusted Preview to an untrusted folder.

To change the source, continue with HTML source editing and formatting.

© 2026 Markdown Explorer