Given that the Visual Studio Code is based on Chrome web kit
Could we open the preview inside the editor as a panel ?
According to this page, this feature is highly requested !
Start by opening the extensions tab inside of VS Code. Then search for Browser Preview and click install. Now that you have the extension installed, let's see how to use it. This extension basically opens a (headless) browser window inside of VS Code.
This extension provide preview of HTML which execute on web server. When you save files, this extension automatically reload browser or side panel (live preview feature). You can call these features from the context menu or editor menu. The main features are as follows. Preview on side panel (ctrl+shift+v): Open preview of HTML on side panel.
For example, the built-in Markdown extension uses webviews to render Markdown previews. Webviews can also be used to build complex user interfaces beyond what VS Code's native APIs support. Think of a webview as an iframe within VS Code that your extension controls.
vscode-preview-server. Features. This extension provide preview of HTML which execute on web server. When you save files, this extension automatically reload browser or side panel (live preview feature). You can call these features from the context menu or editor menu. The main features are as follows.
Well for now, based on Dan Shryock's answer here and this post, here is what I did:
npm install -g live-server
live-server
at the project folderCreate a live-view.md file with this in it (Place it wherever you want. I put it at the base folder of all my projects since I can use it for whatever I'm currently working on):
<div style="border:1px solid #777;position:absolute;left:10px;top:10px;bottom:10px;right:10px;">
<iframe src="http://localhost:8080/"; width="100%" height="100%" frameborder="0" />
</div>
Open live-view.md in the second/split pane in VS Code and click the "Open preview" button (top right of file).
Now whenever I save I see the changes show in the live-preview.
For the moment, here how i solve it : Editing the file
C:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\parts\
markdown\browser\resources\welcome-mac.md
with super-admin rights, and adding
<input type="text" value="http://127.0.0.1:8080/" id="preview" onkeydown="var k = event.which; if (k==8) this.value = this.value.slice(0, -1);else if (k==13) document.getElementById('prevButton').click(); else this.value+=String.fromCharCode((96 <= k && k <= 105)? k-48 : k); "/>
<input type="button" onclick="window.location.replace(document.getElementById('preview').value);" value="Preview" id="prevButton" />
Then just open Welcom Page in the Menu you will have this
Finally add a white background to your html body
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With