VsixCommunity / Community.VisualStudio.Toolkit

Making it easier to write Visual Studio extensions
Other
249 stars 44 forks source link

Possible to show markdown file in preview mode? #421

Closed ErikEJ closed 1 year ago

ErikEJ commented 1 year ago

With 17.5 we can now edit markdown files natively.

I have a dynamically generated .md file I would to show in the preview window - I am using:

  await VS.Documents.OpenInPreviewTabAsync(readmePath);

Is there any way I can open the markdown editor in "preview" mode?

reduckted commented 1 year ago

Do you want the equivalent of pressing the "Toggle Markdown Preview" button? image

Or do you want the entire tab to show the preview?

ErikEJ commented 1 year ago

Ideally preview pane only. (Asking a lot...)

reduckted commented 1 year ago

I think you're out of luck either way. 😞

The extension is located in [INSTALL_DIR]\Common7\IDE\CommonExtensions\Microsoft\Markdown.

If you take a look at the assemblies in ILSpy, you can see that it uses an editor margin for the preview button (so there isn't a command you can execute to open the preview) and an editor margin for the preview (so it's locked in to being side-by-side with the markdown editor).

ErikEJ commented 1 year ago

Never mind, it was a far stretch - thanks for investigating!