`README` badges not getting rendered properly in `pkgdown` website - r

I have thus far created 6 different pkgdown websites for my R packages (e.g., ggstatsplot, kittyR, etc.) and none of them ever had the following issue.
For the first time, running the following command
pkgdown::build_site(
lazy = FALSE,
run_dont_run = TRUE,
seed = 123,
devel = TRUE
)
is not rendering README badges and I am not sure why since the yaml I am using is similar to my other packages. I had raised issue on pkgdown GitHub repo, but it didn't help.
More explicitly, here is what my README looks like-
README: https://github.com/IndrajeetPatil/ipmisc/blob/master/README.md
And here is what the pkgdown output looks like-
pkgdown: https://indrajeetpatil.github.io/ipmisc/
I get no warnings or errors while building the website., but as can be seen here, the badges are not rendered at all on the homepage. Any ideas on why this might be happening or how to resolve it?
Thanks in advance.

I was able to replicate the issue with the README file you linked. I noticed that adding text (any characters) in backticks before the first heading made the badges re-appear. The reason has to do with how pkgdown parses the readme to look for badges. As a workaround, you could try adding the word "test" in backticks at line 16 of your README.Rmd file.
This seems to have now been resolved in the dev version of pkgdown. See the discussion of the issue for more details and consider using <!-- badges: start --> and <!-- badges: end --> around the badges section.

Related

Bundle exec jekyll serve: builds a page2 folder with index.html

The problem
I'm running into a conflict error and a strange issue where my Homepage title is modified and "- Page 2" appears in the tab itself when I place a certain post inside the _posts folder. When I take this specific post out, the problem is resolved. The blog post itself works properly and I'm not encountering other issues. I'm running Minimal Mistakes theme and I'm knitting .Rmd reports in RStudio with GitHub flavored markdown.
Link to my main repo
Link to the specific post inside repo
Link to config.yml
YAML header for knitting .Rmd
title: "Data visualisation"
date: "`r Sys.Date()`"
output:
md_document:
variant: gfm
Knitting options for Rmd
library(knitr)
# macOS
# setwd("~/Developer/mkruisbrink.github.io/_reports/R-for-data-science/01-explore/01-data-visualisation/")
# Windows
setwd("D:/Max Kruisbrink/Developer/mkruisbrink.github.io/_reports/R-for-data-science/01-explore/")
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file())
# define knitr paths for macOS
#base.dir <- "~/Developer/mkruisbrink.github.io/"
# define knitr paths for Windows
base.dir <- "D:/Max Kruisbrink/Developer/mkruisbrink.github.io/"
base.url <- "/"
fig.path <- "assets/reports/R-for-data-science/01-explore/01-data-visualisation/"
# set knitr parameters
opts_knit$set(base.dir = base.dir, base.url = base.url)
opts_chunk$set(fig.path = fig.path)
I get a neat .md file which I can place inside my _posts folder with some yaml header. All other posts are processed fine, the error only appears when I place this specific post inside the folder.
YAML header for post
title: "The basics of data visualisation in R"
excerpt: "These are the basics of visualizing data in R, using only the tidyverse functionality"
header:
overlay_image: /assets/images/midjourney-optimised/big-computer-screen-financial-dashoard-optimised.jpg
category:
- Exploration
What I've tried so far
I've tried the following:
Spent at least 2 hours on online research, didn't find any proper relevant sources to help me out here
Manually removing from and adding back all posts from the _posts folder to figure out the problem lies with this specific post
Running bundle update and bundle install
Double checking YAML headers for posts and the config file
Checking .Rmd settings for other reports that are knitted in the same way and cause no issues
Removing the post content from the .md file to see if the bug came from something in the code perhaps
Replacing the whole YAML header with that of a post that causes no issues
Ran --trace in combination with bundle exec jekyll serve for the same conflict results
Ran --verbose in combination with bundle exec jekyll serve and I could find ONE extra instance of something writing index.html to _site. So the following appears twice in the log. I know the culprit is this post but how to get more info on what is causing it?
Writing: D:/Max Kruisbrink/Developer/mkruisbrink.github.io/_site/index.html
Conclusions and questions
I'm starting to run out of options for my current skill level of debugging.
Could it be something relating to _includes or _layouts? I might have tweaked layouts but pretty sure I left the includes folder alone. But why would other posts be unaffected?
Could it be plugin related? I had no problems up until last week suddenly and didn't change any plugin.
Should I update to the latest theme, removing any customization I've done to rule that out
I'm running this in my gemspec
source "https://rubygems.org"
gemspec
gem "webrick"
gem "jekyll-remote-theme"
gem "tzinfo" #windows dependancy?
gem "tzinfo-data"
Can someone point me in a direction here? Getting slightly clueless and I want to be a little cautious with my re-rolling. Thanks in advance!
Edit 2022-12-28
When I remove the permalink: \ from the main index.html file, the error is resolved but when building the site with bundle exec jekyll serve a strange page2 folder is created in _site with its own index.html
However, I still think something is off with certain posts as the error is resolved when I move them to _drafts.
Anyone any thoughts?
There was an issue with the _config.yml file where I was mixing liquid syntax and the pagination plugin.
# Outputting
permalink: pretty
paginate: 5 # amount of posts to show
paginate_path: /page:num/
timezone: Europe/Amsterdam # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# Plugins (previously gems:)
plugins:
- jekyll-paginate
changing the outputting into the following solved my issue.
# Outputting
permalink: /:categories/:title/
timezone: Europe/Amsterdam # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
My final cue was the page2 folder that was being built and the fact that EVERY post that I added to my _posts folder above the number 5 was causing issues.

#title Missing name at line 1

I was getting this error when running devtools::document but had no idea how to troubleshoot. The file that popped up on my installed package when I entered ?MyPackage-package did not match the text in MyPackage-package.R at all. I initially suspected it might have been from adding the awesome citation functionality from RDpack, but this was not the culprit. How did I go about ultimately fixing the problem?
The error resulted from incorrect formatting in my PackageName-package.R file.
I had heavily edited the file created by usethis::use_package_doc(), and added all of my roxygen comments Below the default content added by usethis. After looking at the documentation for merTools, I saw that it was ok to have the stuff I understand to be important for roxygen2 to make the .Rd files after and not before all the other roxygen comments.
After moving the stuff created by usethis::use_package_doc() (and not just the NULL line; that was already at the end) to the bottom of the .R file, everything seemed to render fine and this error disappeared.

rmarkdown::render_site() Error in rmarkdown::render_site() : No site generator found

I am trying to knit together 3 files using this example: http://rmarkdown.rstudio.com/rmarkdown_websites.html
My files all share the same directory, which has been set in the RStudio build options. I literally copied the YML from the examples with my own file names. Even if I copy the examples directly, I get the same error.
I even ran the site_generator function from the RMarkdown Github: https://github.com/rstudio/rmarkdown/blob/master/R/render_site.R#L157
I noticed there are options for custom generators, which I do not want. All I would like to do is be able to knit together several markdown files into a single webpage and then create a navbar with tabs for each page/section.
I got the same error when attempting to build with an incorrectly named YAML config file. Specifically, the RStudio build option for a website requires that the config file be called _site.yml.
Verify that this file exists and that you're using the extension .yml rather than .yaml (even though the latter is preferred).
What helped for me was putting the line site: bookdown::bookdown_site back to index.Rmd.
lord, my issue was that i didn't set my working directly to where my _site.yml file and index.Rmd files are stored - the little things!
I fixed this error using this steps.
1-) RStudio-Tools-InstallPackages
2-) Install From should be CRAN Repository.
3-) write this command --> install.packages("install.packages("rmarkdown")")
4-) Click Install
And problem has gone... And this is output.
This error also appears when there is a format issue in the yaml section of index.Rmd.
In my case, I encountered the error when the opening "---" in index.Rmd had a couple of white spaces " ---".
If you are having this problem, I would recommend knitting index.Rmd by itself (not building the book) before trying anything more drastic.

\code{\link{function-name}} in roxygen2

It is my first experience in writing an R-package. I used roxygen2 by following the instructions given in this link http://kbroman.org/pkg_primer/
Everythig is working fine except few things.. there could be a simpler solution to solve the issues, but I am not finding clues what I am doing wrong. I hope someone here in this blog can give a solution to solve my issues.
First issue is about {\code\link{function-name}} in roxygen2:
In .R script I inlcuded this line:
#' #seealso \code{\link{s2a}}
After documenting (generating .Rd files) there is no hyperlink to s2a ,
in documentation s2a shows like a normal text not like hyperlink..
export(s2a) is listed out in NAMESPACE.
Is there any other place i need to modify ?
Second issue is about data():
I saved the dataset in .Rdata format and placed in the data/ in package directory. I also created the .R script in R/ as like following steps here http://kbroman.org/pkg_primer/pages/data.html
In DESCRIPTION file LazyData: true .
but when I type data(shh) in R console gives a warning message
data(shh)
Warning message:
In data(shh) : data set ‘shh’ not found
Any ideas is of great help:)
It's been a while since you asked this, but I was having the exact same problem with hyperlinks in documentation not appearing correctly, so for anyone who might be having a similar problem: Are you possibly viewing the development documentation? The links don't seem to work there. (You'll know this is the case if you see Using development documentation for your_function_name in your console output when you run ?your_function_name.)
The links should appear in the non-development documentation. To generate this you can try building and reloading your package, for instance by following the steps here: http://r-pkgs.had.co.nz/man.html#man-workflow-2

How can I have the NEWS displayed in the html help page of an R package?

The help page of the news() R function says:
it is attempted to read its news in structured form from files
‘inst/NEWS.Rd’, ‘NEWS’ or ‘inst/NEWS’ (in that order).
Doing so and installing the package, we get (under windows) a link to the NEWS file at the top of the html page open by the command help(package=packagename). For an example, assuming you have installed party, you can try
help(package="party")
This works however only with files named NEWS. When we provide instead a NEWS.Rd file, there is no link to the news. Try
help(package="survival")
Is there a way to get this link when we provide a NEWS.Rd file?
Thanks for your help.
The problem has been solved since R 3.0.0.
It seems, however, that a series of the Rd formatting code such as \code{} for example are ignored when rendering the NEWS.Rd in html.

Resources