You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Markdown preview is not automatically opened when md file is opened via command-line and no VS code instance was already running #197374
bugIssue identified by VS Code Team member as probable bugcustom-editorsCustom editor API (webview based editors)help wantedIssues identified as good community contribution opportunities
However this only works if VS code is already running. If no VS code instance is running and you execute code C:\<somepath>\test.md then the md file is opened in edit view and not preview mode.
If you repeat the steps but in step 3 do not close all VS code instances, but have one instance running in step 5 correctly the preview will be displayed.
Why does it make a difference if a VS code instance is already running or not? It should not make a diference, so the current behavior is not deterministic which in my opinion means it is a bug.
Just retried it on a different Windows 11 system and the behavior is mostly as described in my initial post: md file is opened only in editor view.
The strange part is that it is non-deterministic. If the folder the md file is located in is not a trusted path I am getting in 90% of all cases the pure edit view. And in about 10% the full-screen MD preview as shown in Manav Agarwal (@manav014) video pops up.
If I add the folder to the list of trusted folders then then it works similar just in 90% of all cases the vertical split view is shown with left the editor and right the preview. And in 10% of all cases only the full-screen preview is shown.
I believe this bug affects not only a file opened from the command line, but also a file opened through the openFilesfeature in Codespaces. That is, when I have openFiles configured to open my README.md file, it is shown as raw Markdown code in the editor. If I click the file icon in the explorer view to open it, it's displayed in Preview mode as it should be.
bugIssue identified by VS Code Team member as probable bugcustom-editorsCustom editor API (webview based editors)help wantedIssues identified as good community contribution opportunities
Activity
manav014 commentedon Jul 20, 2024
I tried reproducing this issue with the latest stable release using following configuration.
And I couldn't reproduced the issue. Steps I followed to reproduce are as follows:
codecommand.PFA - POC video
Screen.Recording.2024-07-21.at.2.43.59.AM.mov
jpstotz commentedon Jul 21, 2024
Just retried it on a different Windows 11 system and the behavior is mostly as described in my initial post: md file is opened only in editor view.
The strange part is that it is non-deterministic. If the folder the md file is located in is not a trusted path I am getting in 90% of all cases the pure edit view. And in about 10% the full-screen MD preview as shown in Manav Agarwal (@manav014) video pops up.
If I add the folder to the list of trusted folders then then it works similar just in 90% of all cases the vertical split view is shown with left the editor and right the preview. And in 10% of all cases only the full-screen preview is shown.
starball5 commentedon Dec 14, 2024
Related on Stack Overflow: https://stackoverflow.com/q/79260419/11107541
tomwheeler commentedon Apr 23, 2026
I believe this bug affects not only a file opened from the command line, but also a file opened through the
openFilesfeature in Codespaces. That is, when I haveopenFilesconfigured to open my README.md file, it is shown as raw Markdown code in the editor. If I click the file icon in the explorer view to open it, it's displayed in Preview mode as it should be.