feat(markdown): add render command (fixes #75612)

This adds a command which renders the provided document, or the active
editor if one is provided. Following the pattern of some of the preview
commands, it returned `undefined` if there's no document provided and
no active text editor. Otherwise, seems to work...

```ts
const html = await vscode.commands.executeCommand<string>('markdown.render');
```

A way to render arbitrary strings in addition to documents may be useful at
some point in the future. However, I didn't implement that here as that'd
require some refactoring of the markdown engine. If we're interested though
I could certainly give that a shot.
This commit is contained in:
Connor Peet
2019-07-10 15:49:06 -07:00
parent 878fc5ddee
commit 7dd109c2df
4 changed files with 34 additions and 1 deletions

View File

@@ -24,6 +24,7 @@
"onCommand:markdown.showLockedPreviewToSide",
"onCommand:markdown.showSource",
"onCommand:markdown.showPreviewSecuritySelector",
"onCommand:markdown.render",
"onWebviewPanel:markdown.preview"
],
"contributes": {
@@ -325,4 +326,4 @@
"webpack": "^4.1.0",
"webpack-cli": "^2.0.10"
}
}
}