# installed by winget
winget install PowerShell-Preview
winget install git
git config --global user.name "Christophe Dervieux"
git config --global user.email christophe.dervieux@gmail.com
winget install rstudio
winget install vscode
winget install -e R
winget install Github.GithubDesktop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_pandoc_metadata <- function(file, to = "html") { | |
template <- tempfile(fileext = ".json") | |
json_out <- tempfile(fileext = ".json") | |
xfun::write_utf8("$meta-json$", template) | |
template_arg <- sprintf("--template=%s", template) | |
rmarkdown::pandoc_convert(file, from = "markdown", to = to, | |
options = c(template_arg), | |
output = json_out) | |
jsonlite::fromJSON(json_out) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==> rmarkdown::render_site(output_format = 'bookdown::gitbook', encoding = 'UTF-8') | |
|......................................................................| 100% | |
inline R code fragments | |
processing file: index.Rmd | |
output file: index.knit.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(magrittr) | |
library(usethis) | |
# We want to keep question and not rename it to reprex so | |
# 1. Add question label with color and description | |
# 2. Remove renaming of question to reprex | |
labels <- c(tidy_labels(), "question") | |
rename <- tidy_labels_rename() %>% {.[names(.) != "question"]} | |
colors <- c(tidy_label_colours(), "FBCA04") | |
description <- c(tidy_label_descriptions(), "questions not answered anywhere else") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Use R in a lua filter" | |
output: | |
html_document: | |
pandoc_args: !expr rmarkdown::pandoc_lua_filter_args("my.lua") | |
--- | |
This document will have uppercase header using R function `toupper()` | |
```{cat, engine.opts = list(file = "my.lua")} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: test-gfm2.md test-gfm.md | |
test-gfm2.md: test.md | |
pandoc -f markdown+gfm_auto_identifiers -t gfm -s --table-of-contents -o $@ $< | |
test-gfm.md: test.md | |
pandoc -f markdown -t gfm -s --table-of-contents -o $@ $< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- MIT LICENCE - 2021 Christophe Dervieux | |
-- Only works with Pandoc 2.1.2+ because of PANDOC_SCRIPT_FILE availability | |
function import(script) | |
local PATH_SEP = package.config:sub(1,1) | |
local path = PANDOC_SCRIPT_FILE:match("(.*"..PATH_SEP..")") | |
dofile(path .. script) | |
end | |
import("utils.lua") |