Code Monkey home page Code Monkey logo

Comments (13)

jjallaire avatar jjallaire commented on August 19, 2024 3

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 rstudio/rmarkdown@3c33142

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")

from distill.

apreshill avatar apreshill commented on August 19, 2024 2

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:

from distill.

jjallaire avatar jjallaire commented on August 19, 2024 1

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

from distill.

MilesMcBain avatar MilesMcBain commented on August 19, 2024 1

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.

from distill.

jjallaire avatar jjallaire commented on August 19, 2024

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!

from distill.

brunaw avatar brunaw commented on August 19, 2024

@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

from distill.

brunaw avatar brunaw commented on August 19, 2024

@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!

from distill.

jjallaire avatar jjallaire commented on August 19, 2024

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

from distill.

brunaw avatar brunaw commented on August 19, 2024

@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

from distill.

jjallaire avatar jjallaire commented on August 19, 2024

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.

from distill.

brunaw avatar brunaw commented on August 19, 2024

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

from distill.

jjallaire avatar jjallaire commented on August 19, 2024

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).

from distill.

jdblischak avatar jdblischak commented on August 19, 2024

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).

from distill.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.