Comments (5)
It's automatic. All the ones installed should be shown in the template. For example, install the package tufte
and a submenu in RMarkdown > Template > Tufte
will appear. See the doc string of poly-r-rmarkdown-create-from-template
for a few examples of common packages that provide the templates. Let me know if you find more.
from poly-r.
There might be R/ESS/poly-R version mismatch. What versions do you use? You need fairly recent poly-R for this. The relevant R code is here.
It boils down to the following:
list_templates <-
function(user_dirs) {
user_dirs <- c(user_dirs, unlist(lapply(user_dirs, list.dirs, recursive = FALSE)))
list_from_dir <- function(dir, pkg = NULL) {
pkg_name <- if(is.null(pkg)) 'USER' else pkg
if (dir.exists(dir)) {
dirs <- list.dirs(dir, recursive = FALSE)
for (d in dirs) {
yaml_file <- file.path(d, 'template.yaml')
if (file.exists(yaml_file)) {
yaml <- rmarkdown:::yaml_load_file_utf8(yaml_file)
if (is.null(desc <- yaml$description)) desc <- 'nil'
cat(sprintf('(\"%s\" \"%s\" \"%s\" \"%s\")\n', pkg_name, d, yaml$name, desc))
}
}
}
}
cat('(\n')
for (user_dir in user_dirs) {
files <- list.files(user_dir, '\\.[Rr]md$', full.names = TRUE)
for (f in files) {
name <- sub('\\.[^.]+$','', basename(f))
cat(sprintf('(\"USER\" \"%s\" \"%s\")\n', f, name))
}
list_from_dir(user_dir)
}
packages <- sort(unlist(lapply(.libPaths(), dir)))
for (pkg in packages) {
template_folder <- system.file('rmarkdown', 'templates', package = pkg)
list_from_dir(template_folder, pkg)
}
cat(')\n')
}
list_templates(c())
and should produce something along:
(
("rmarkdown" "/home/vspinu/.lib/3.6.0/rmarkdown/rmarkdown/templates/github_document" "GitHub Document (Markdown)" "Template for documents to be published as GitHub Flavored Markdown.
")
("rmarkdown" "/home/vspinu/.lib/3.6.0/rmarkdown/rmarkdown/templates/html_vignette" "Package Vignette (HTML)" "Template for package vignettes. This customises the basic HTML output to take up as little space as possible.
")
("tufte" "/home/vspinu/.lib/3.6.0/tufte/rmarkdown/templates/tufte_ctex" "Tufte Handout (HTML or PDF in Chinese)" "A Chinese template for creating a handout according to the style of Edward R. Tufte and Richard Feynman.
")
("tufte" "/home/vspinu/.lib/3.6.0/tufte/rmarkdown/templates/tufte_html" "Tufte Handout (HTML or PDF)" "Template for creating a handout according to the style of Edward R. Tufte and Richard Feynman.
")
)
from poly-r.
Got it. I found an issue with the call to rmarkdown:::yaml_load_file_utf8
. In recent versions of rmarkdown
this function has been renamed yaml_load_file
(rstudio/rmarkdown@8e62228). With that fixed in my local copy of poly-r.el, and after running byte-compile-file
, the items are found, and the menu now looks as expected.
from poly-r.
Thanks for identifying the issue. Should be fixed now.
from poly-r.
I have the same issue..
from poly-r.
Related Issues (20)
- error on startup: poly-R/:catch: Symbol’s value as variable is void: poly-noweb-innermode HOT 3
- Error on startup - Unknown specializer "R" HOT 3
- Rd mode uses percent for comment-start HOT 2
- Menubar crashes Aquamacs when R buffer is open HOT 16
- poly-R start up error HOT 2
- Fontification error Rmd files HOT 2
- Losing track of org buffer with smartparens HOT 1
- How to change to latex-mode in math enviroments HOT 1
- template menu not populated HOT 1
- Support for Github-flavored markdown mode HOT 1
- poly-R no longer works in doom HOT 1
- File mode specification error: (void-variable keymap) HOT 1
- R chunks starting with a single-commented line not indented on first line HOT 1
- Cannot evaluate R in flatwhatson/emacs-pgtk-nativecomp build HOT 6
- Loading template for .Rmd file and using it
- Call bookdown exporter interactively HOT 3
- How to enable shell-escape latex option? HOT 2
- RMarkdown template menu population so slow making emacs menu system unusable
- poly-r fails to load when using `straight.el` HOT 1
- Bug when typing in Markdown after using ESS with LSP HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poly-r.