diff --git a/extensions/markdown/package.json b/extensions/markdown/package.json
index 295f09a810c1a117b5be4378f5791be47a21d436..43a245bd04b2f01e6e73871a46dd82e68c6cb54b 100644
--- a/extensions/markdown/package.json
+++ b/extensions/markdown/package.json
@@ -130,6 +130,21 @@
],
"default": "hide",
"description": "%markdown.previewFrontMatter.dec%"
+ },
+ "markdown.preview.fontFamily": {
+ "type": "string",
+ "default": "'Segoe WPC', 'Segoe UI', 'SFUIText-Light', 'HelveticaNeue-Light'",
+ "description": "%markdown.preview.fontFamily.desc%"
+ },
+ "markdown.preview.fontSize": {
+ "type": "number",
+ "default": 14,
+ "description": "%markdown.preview.fontSize.desc%"
+ },
+ "markdown.preview.lineHeight": {
+ "type": "number",
+ "default": 1.6,
+ "description": "%markdown.preview.lineHeight.desc%"
}
}
}
diff --git a/extensions/markdown/package.nls.json b/extensions/markdown/package.nls.json
index dbdafe5963f4eac0300a11697eb38bfa0a9d4a82..d14a486d9774aaa4bfaae3c0b27a55b557c6d93c 100644
--- a/extensions/markdown/package.nls.json
+++ b/extensions/markdown/package.nls.json
@@ -3,5 +3,8 @@
"markdown.previewSide.title" : "Open Preview to the Side",
"markdown.showSource.title" : "Show Source",
"markdown.styles.dec": "A list of URLs or local paths to CSS style sheets to use from the markdown preview. Relative paths are interpreted relative to the folder open in the explorer. If there is no open folder, they are interpreted relative to the location of the markdown file. All '\\' need to be written as '\\\\'.",
- "markdown.previewFrontMatter.dec": "Sets how YAML front matter should be rendered in the markdown preview. 'hide' removes the front matter. Otherwise, the front matter is treated as markdown content"
+ "markdown.previewFrontMatter.dec": "Sets how YAML front matter should be rendered in the markdown preview. 'hide' removes the front matter. Otherwise, the front matter is treated as markdown content.",
+ "markdown.preview.fontFamily.desc": "Controls the font family used in the markdown preview.",
+ "markdown.preview.fontSize.desc": "Controls the font size in pixels used in the markdown preview.",
+ "markdown.preview.lineHeight.desc": "Controls the line height used in the markdown preview. This number is relative to the font size."
}
\ No newline at end of file
diff --git a/extensions/markdown/src/extension.ts b/extensions/markdown/src/extension.ts
index 732f549a4117d5735c61b5f5d48cc89f55338b78..ca55ce1601487d44e6b891f5da60a8faa51c86e6 100644
--- a/extensions/markdown/src/extension.ts
+++ b/extensions/markdown/src/extension.ts
@@ -223,6 +223,22 @@ class MDDocumentContentProvider implements vscode.TextDocumentContentProvider {
return [];
}
+ private getSettingsOverrideStyles(): string {
+ const previewSettings = vscode.workspace.getConfiguration('markdown')['preview'];
+ if (!previewSettings) {
+ return '';
+ }
+ const {fontFamily, fontSize, lineHeight} = previewSettings;
+ return [
+ ''].join('\n');
+ }
+
public provideTextDocumentContent(uri: vscode.Uri): Thenable {
return vscode.workspace.openTextDocument(vscode.Uri.parse(uri.query)).then(document => {
const scrollBeyondLastLine = vscode.workspace.getConfiguration('editor')['scrollBeyondLastLine'];
@@ -233,6 +249,7 @@ class MDDocumentContentProvider implements vscode.TextDocumentContentProvider {
'',
``,
``,
+ this.getSettingsOverrideStyles(),
this.computeCustomStyleSheetIncludes(uri),
``,
'',