Skip to content
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

Allow for width/height setting when specifying an external image via markdown #1614

Open
coatless opened this issue Apr 22, 2024 · 0 comments

Comments

@coatless
Copy link

When trying to add an image sitting in man/figures, I'm running into a problem with specifying height/width constraints.

This works:

![](pkg-overview.png "Package Overview")

But, adding width or height keys causes the markdown to leak through, e.g. we in the Rd:

![](pkg-overview.png "Package Overview" width="500px")

From 2.7 Figures, I think at least width can be specified using regular \figure markup, e.g.

\if{html}{\figure{Rlogo.svg}{options: width=100 alt="R logo"}}
\if{latex}{\figure{Rlogo.pdf}{options: width=0.5in}}

Would it be possible to expose a width key on images? I think this would involve changing:

roxygen2/R/markdown.R

Lines 422 to 424 in 2357de6

mdxml_image <- function(xml) {
dest <- xml_attr(xml, "destination")
title <- xml_attr(xml, "title")

And updating documentation here:

### Images
Markdown syntax for inline images works.
The image files must be in the `man/figures` directory:
``` r
#' Here is an example plot:
#' ![](example-plot.jpg "Example Plot Title")
```

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

No branches or pull requests

1 participant