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

v0.14 no longer allow images with links in aside #226

Closed
mcanouil opened this issue Apr 20, 2021 · 3 comments
Closed

v0.14 no longer allow images with links in aside #226

mcanouil opened this issue Apr 20, 2021 · 3 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@mcanouil
Copy link

mcanouil commented Apr 20, 2021

The latest update of pagedown introduced a bug with images associated with links (markdown or html syntax).
The images are removed from the resulting HTML file.

Below, the outputs with v0.13 and v0.14 from the exact same Rmarkdown document.

With pagedown v0.13
image

With pagedown v0.14
image

---
title: "Lijia Yu's resume"
author: Lijia Yu
date: "`r Sys.Date()`"
output:
  pagedown::html_resume:
    # set it to true for a self-contained HTML page but it'll take longer to render
    self_contained: false
# uncomment this line to produce HTML and PDF in RStudio:
#knit: pagedown::chrome_print
---

Aside
================================================================================

![Lijia Yu](https://avatars1.githubusercontent.com/u/895125?s=400&v=4){width=80%}

Contact Info {#contact}
--------------------------------------------------------------------------------

- <i class="fa fa-envelope"></i> lijia.yu@outlook.com
- ![](https://user-images.githubusercontent.com/163582/51942716-66be4180-23dd-11e9-8dbc-fdb4f465d1c2.png){width=50%}
- <i class="fa fa-github"></i> [github.com/yulijia](https://github.com/yulijia)
- <i class="fa fa-phone"></i> +1 000-000-0000
- For more information, please contact me via email.
- A picture with a link  
[![](https://user-images.githubusercontent.com/163582/51942716-66be4180-23dd-11e9-8dbc-fdb4f465d1c2.png){width=50%}](https://github.com/rstudio/pagedown)

Disclaimer {#disclaimer}
--------------------------------------------------------------------------------

This resume was made with the R package [**pagedown**](https://github.com/rstudio/pagedown).

Last updated on `r Sys.Date()`.

Main
================================================================================

Lijia Yu {#title}
--------------------------------------------------------------------------------

### Currently searching for a PhD student position

Please note that this is a *real* resume, and I'm really looking for a PhD
student position at the moment. I made this resume because Yihui asked me
if I'd like to test the **pagedown** package with my resume. If you are
interested in my background and skills, please feel free to contact me.
@RLesur RLesur closed this as completed in 9d1a256 Apr 20, 2021
@RLesur
Copy link
Collaborator

RLesur commented Apr 20, 2021

Thanks a lot for this bug report!
I'm so sorry to have introduced this ugly bug. This is now fixed in the development version.

@RLesur RLesur added the bug an unexpected problem or unintended behavior label Apr 20, 2021
@datawookie
Copy link

datawookie commented Sep 19, 2021

Hi @RLesur,

Thanks for working on this issue.

Are you sure that it's fixed? I'm having trouble with using images as link anchors (tested on both the current master branch on GitHub as well as commit 9d1a256).

The is my R Markdown:

---
title: "Test Document"
output:
  pagedown::html_paged:
    self_contained: true
---

The R logo: `r fontawesome::fa(name = "r-project", fill = "steelblue")`.

FA Markdown link: [`r fontawesome::fa(name = "r-project", fill = "steelblue")`](https://cran.r-project.org/).

[![](https://user-images.githubusercontent.com/163582/51942716-66be4180-23dd-11e9-8dbc-fdb4f465d1c2.png){width=50%}](https://github.com/rstudio/pagedown)

And this is what the rendered results look like:

image

In both cases (the FontAwesome R logo and the image) the link works! But there's the duplicate copy of the URL included as well.

And this is happening in the body of the document, not the aside.

Any ideas?

Best regards, Andrew.

@cderv
Copy link
Collaborator

cderv commented Sep 20, 2021

Hi,

Thanks for opening a comment. Usually, we prefer new issue (with link to closed one) rather than comments in closed thread. Specifically when it is not directly related to the main issue.

And this is happening in the body of the document, not the aside.

This indicated that it is not directly related to this issue which is focused on the aside part. This should live in another issue for discussion.

But there's the duplicate copy of the URL included as well.

This is expected in the default behavior (however I recognized that this is not as convenient with image) : https://pagedown.rbind.io/#inline-links
inline link will be also shown in parenthesis - doc says:

When printing a document, we lose interactivity. So we need to show the hidden URLs. By default, the html_paged format adds the URLs after the link text in parentheses, for instance bookdown website is rendered as bookdown website.

So that is why you see the url in parenthesis. Try also without image:

---
title: "Test Document"
output:
  pagedown::html_paged:
    self_contained: true
---

This is an inline link: [bookdown website](https://bookdown.org)

image

As the doc says, you can put the link in footnote using

---
title: "Test Document"
output:
  pagedown::html_paged:
    self_contained: true
links-to-footnotes: true
---

but this will still create a footnote on image
image

pagedown aims at producing paginated report that often will get printed and inline link hidden behind text, images or logos won't show unless we do something like the above.

@RLesur do we need to adjust behavior here ? Can we maybe offer an opt-out way if desired to not show the link ? Like a global variable set to false, or maybe an attributes in the inline image link ?

What do you think ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants