rstudio / distill

Distill for R Markdown
https://rstudio.github.io/distill/
Apache License 2.0
422 stars 57 forks source link

error with pandoc and title #52

Open brunaw opened 5 years ago

brunaw commented 5 years ago

Hello! I can't create new blog using radix because of the following error:

Error: Radix requires Pandoc v2.0 or greator. Please update at: https://github.com/jgm/pandoc/releases/latest

I already updated pandoc here 3 times, restarted the computer and reinstalled radix from github and I keep getting the error. Also, when I try to render my older blogs, I get:

Error: You must provide a title for Radix articles

But they where ok in the last time I tried. I'm not sure about what changed now )-:

jjallaire commented 5 years ago

There was an error in the CRAN version of Radix related to version checking. Try installing the development version of Radix with:

devtools::install_github("rstudio/radix")

In terms of the other error, if you could point me to a reproducible example of the problem I'll investigate!

brunaw commented 5 years ago

@jjallaire I did reinstalled using the github version! )-: Still get the pandoc error even with the newest pandoc (I'm using macOS)

The blog I'm trying to render and have the title error is this one: https://github.com/rladies/blog-rladies-latam

jjallaire commented 5 years ago

Okay, thanks!

The issue w/ the title is because Radix is attempting to render your README.md as a Radix article. If you just remove that file then you won't see that error.

In terms of pandoc, what is the output of:

rmarkdown:::.pandoc$dir
rmarkdown:::.pandoc$version
brunaw commented 5 years ago

@jjallaire thank you so much!

I’m away from the computer now but as soon as I can check the output I post it here! My main problem was with that specific repository anyway :) Thanks again!

jjallaire commented 5 years ago

np, let me know what you find out re: pandoc

brunaw commented 5 years ago

@jjallaire Apparently everything is working now. My pandoc version is:

> rmarkdown::pandoc_version()
[1] ‘2.3.1’

Just one more question: can I change the content language in Radix? I would like to use Portuguese or Spanish

MilesMcBain commented 5 years ago

I had this same problem with the README.md even though I had it listed in exclude in the _site.yml. It appears this is not being respected, is this a bug?

I am using the latest GitHub version at the time of writing.

jjallaire commented 5 years ago

I've made a change that prevents the error from occurring in this case (we just provide a default title of "Untitled").

In terms of exclude support for README.md, the exclude directive is used to determine which files are copied over to the _site (as opposed to which files are rendered). All Rmd and md files will automatically be rendered.

brunaw commented 5 years ago

@jjallaire Is it possible to change the content language in Radix? to Portuguese or Spanish for example

jjallaire commented 5 years ago

You can set the language on the <html> element using the lang pandoc metadata option: http://pandoc.org/MANUAL.html#language-variables.

That said, there is non-localized text emitted by Radix so you would have some English text where you'd want e.g. Spanish text (e.g. the names of the appendixes).

jdblischak commented 5 years ago

I had this same problem with the README.md even though I had it listed in exclude in the _site.yml. It appears this is not being respected, is this a bug?

@MilesMcBain It appears that .md files are treated the same as .Rmd files, so this isn't a bug necessarily. From the R Markdown book:

Note that include and exclude are not used to determine which Rmd files are rendered: all of them in the root directory save for those named with the _ prefix will be rendered.

However, I still couldn't get it to behave as I expected.

In terms of exclude support for README.md, the exclude directive is used to determine which files are copied over to the _site (as opposed to which files are rendered). All Rmd and md files will automatically be rendered.

@jjallaire If exclude determines which files are copied to _site, I would expect exclude: ["README.html"] to prevent README.html from being copied to the output directory. However, it still gets copied. Also, because I have base_url set, the README.htmlentry gets added to sitemap.xml.

Here is a reproducible example:

library(distill)
packageVersion("distill")
path <- tempfile()
distill::create_blog(dir = path, title = "reprex", edit = FALSE)
cat('base_url: https://testing-distill.com\n',
    file = file.path(path, "_site.yml"), append = TRUE)
file.create(file.path(path, "README.md"))
library(rmarkdown)
render_site(input = path, encoding = "UTF-8")
file.exists(file.path(path, "_site/README.html"))
file.remove(file.path(path, "_site/README.html"))
cat('exclude: ["README.html"]\n', file = file.path(path, "_site.yml"), append = TRUE)
render_site(input = path, encoding = "UTF-8")
file.exists(file.path(path, "_site/README.html"))
grep("README", readLines(file.path(path, "_site/sitemap.xml")), value = TRUE)

I tried using the reprex package, but it failed with Error: Distill articles cannot be previewed in this version of RStudio. I am using the latest version from GitHub (currently 0.7).

apreshill commented 5 years ago

I'm stumbling into this README issue as well- has anyone found a way to use Distill and still have a GitHub-rendered README?

I have a README.Rmd for a workshop that I knit to github_document so that it shows up in the GitHub repo. Unfortunately, once I added a Distill site, it cannot respect either my README.Rmd or README.md in the project root. I also tried adding to exclude as @jdblischak and @MilesMcBain did, and luckily stumbled upon this issue from there. I am now noticing that no Distill sites have a README:

jjallaire commented 5 years ago

There are 2 issues here:

1) rmarkdown::render doesn't respect the output: github_document when within a site directory.

2) rmarkdown::render_site processes README.Rmd and clobbers any .md that may have been previously generated.

I have fixed #2 via https://github.com/rstudio/rmarkdown/commit/3c33142ff4647627537c7bf8d5dfc15b13f96330

For #1, the fix would be a bit more risky/intrusive because we'd have to change the code which determines the default output format for render (already a somewhat complex codepath). For now (once you have rmarkdown from master installed) you should be able to do this to generate a README.md:

rmarkdown::render("README.Rmd", output_format = "github_document")