Skip to content

Commit 7e3d97c

Browse files
RMD Preview: font-size setting (#1333)
* preview: font-size * fallback size * Use zoom instead of fontSize (#1348) --------- Co-authored-by: Kun Ren <renkun@outlook.com>
1 parent e4b56ce commit 7e3d97c

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,11 @@
15441544
"default": true,
15451545
"markdownDescription": "Enable automatic refresh of R Markdown preview on file update."
15461546
},
1547+
"r.rmarkdown.preview.zoom": {
1548+
"type": "number",
1549+
"default": 1,
1550+
"markdownDescription": "Controls the zoom of the R Markdown preview."
1551+
},
15471552
"r.rmarkdown.knit.useBackgroundProcess": {
15481553
"type": "boolean",
15491554
"default": true,

src/rmarkdown/preview.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,11 @@ class RMarkdownPreview extends vscode.Disposable {
8787
const $ = cheerio.load(content);
8888
this.htmlLightContent = $.html();
8989

90+
const zoom = config().get<number>('rmarkdown.preview.zoom', 1);
91+
9092
// make the output chunks a little lighter to stand out
9193
let chunkCol = String(config().get('rmarkdown.chunkBackgroundColor'));
94+
9295
let outCol: string;
9396
if (chunkCol) {
9497
const colReg = /[0-9.]+/g;
@@ -106,6 +109,7 @@ class RMarkdownPreview extends vscode.Disposable {
106109
const style =
107110
`<style>
108111
body {
112+
zoom: ${zoom};
109113
color: var(--vscode-editor-foreground);
110114
background: var(--vscode-editor-background);
111115
}

0 commit comments

Comments
 (0)