Skip to content

RMD Preview: font-size setting #1333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 27, 2023
Merged

RMD Preview: font-size setting #1333

merged 3 commits into from
Apr 27, 2023

Conversation

ElianHugh
Copy link
Collaborator

@ElianHugh ElianHugh commented Mar 18, 2023

What problem did you solve?

Solves #1332 by injecting font-size in the preview HTML's css.

(If you do not have screenshot) How can I check this pull request?

Render the following, modifying the r.rmarkdown.preview.fontSize setting or the markdown.preview.fontSize setting to change the size of text in the preview.

# H1

Foo.

## H2

Bar.

### H3

Baz.

#### H4

Foo.

##### H5

Bar.

```{r}
x <- 1
x
```

@renkun-ken
Copy link
Member

Does it overwrite a themed document which has its own CSS font-size of those h1-h5 headers?

@ElianHugh
Copy link
Collaborator Author

It would depend on the html theme's css -- if it has higher priority styling then no. typically yes this will override that.
admittedly, i'm not sure how to handle that, should themeing be respected in previews?

@renkun-ken
Copy link
Member

Not sure if we should hard-code some font-size adjustment or just use some zoom parameter?

@renkun-ken
Copy link
Member

renkun-ken commented Apr 24, 2023

I tried with some scenarios, looks like adjusting font size may result in many size inconsistencies between different HTML elements such as normal text, headers, images, code blocks, etc.

I find using zoom seems good enough, as suggested in #1348. @ElianHugh What do you think?

@ElianHugh
Copy link
Collaborator Author

That sounds fair, it will work in more situations compared to just font size

@renkun-ken renkun-ken merged commit 7e3d97c into master Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants