Skip to content

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.

3 participants