feat: Add HTML/CSS live preview with asset protocol support #484
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
This PR adds a highly requested feature: Live HTML/CSS Preview directly within the editor. It addresses issue #156 by allowing developers to view rendered HTML files in real-time as they edit, without needing to save the file or open an external browser. Crucially, it solves the problem of relative file paths (like
<link href="style.css">) in unsaved buffers by leveraging Tauri's asset protocol.Description
iframewithsrcDocfor instant rendering of editor content.<base href="...">tag into the preview's HTML. This points to the file's actual directory on disk using the secureasset://protocol, ensuring that relative resources (CSS, JS, Images) load correctly.isHtmlPreviewstate, allowing the editor to manage HTML preview tabs alongside Markdown and code buffers..htmlor.htmfiles.Screenshots/Videos
demo.mp4
Related Issues
Closes #156