-
Hi, I'm having some trouble with this and any help would be appreciated. Say I have a GitHub repo with a subfolder
I have two issues:
GitHub would expect a 'full' filepath here when rendering the markdown file, i.e. it would expect Any help much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is something that is indeed specific to Github Markdown when deployed and rendered to HTML through Github. Links are relative to the repository or absolute. I believe Pandoc is supposed to support this now with the non standard extension rebase_relative_paths See doc https://pandoc.org/MANUAL.html#extension-rebase_relative_paths and discussion in issue (jgm/pandoc#3752) However, it seems this extension does not work with Quarto. ---
title: "First post"
format:
gfm:
output-file: README.md
from: markdown+rebase_relative_paths
---
Here's a plot:
```{r}
hist(rnorm(1000))
``` Which gives me First post
================
Here’s a plot:
``` r
hist(rnorm(1000))
```
 So an absolute because of where Quarto is rendering with pandoc (or something else...) With knitr, there should be a way to do that already by using the This is how you could do it with R Markdown. ---
title: "First post"
output: github_document
---
```{r}
knitr::opts_knit$set(base.url = "firstpost/")
```
Here's a plot:
```{r}
hist(rnorm(1000))
```
resulting in First post
================
``` r
knitr::opts_knit$set(base.url = "firstpost/")
```
Here’s a plot:
``` r
hist(rnorm(1000))
```
<!-- -->
which we want. This should work in Quarto too, at least i would have expected. But the I wonder if we should do that by default for Github document output - Lua is quite simple for that Image = function(el)
el.src = "firstpost/" .. el.src
return el
end Transforming that to an extension, and using some parameter would allow to tweak source url on all images parsed by Pandoc. We could add to @quarto-ext maybe 🤔 Or just internalize in Thanks a lot for your question, as you see it got me thinking 😅 |
Beta Was this translation helpful? Give feedback.
This is something that is indeed specific to Github Markdown when deployed and rendered to HTML through Github. Links are relative to the repository or absolute.
I believe Pandoc is supposed to support this now with the non standard extension rebase_relative_paths See doc https://pandoc.org/MANUAL.html#extension-rebase_relative_paths and discussion in issue (jgm/pandoc#3752)
However, it seems this extension does not work with Quarto.
Which gives me