View source: R/utils-conversion.R
knit2wp | R Documentation |
This function is a wrapper around the RWordPress package. It compiles an R Markdown document to HTML and post the results to WordPress. Please note that RWordPress has not been updated for several years, which is not a good sign. For blogging with R, you may want to try the blogdown package instead.
knit2wp(
input,
title = "A post from knitr",
...,
envir = parent.frame(),
shortcode = FALSE,
action = c("newPost", "editPost", "newPage"),
postid,
publish = TRUE
)
input |
Filename of the Rmd document. |
title |
Title of the post. |
... |
Other meta information of the post, e.g. |
envir |
Environment in which code chunks are to be evaluated, for
example, |
shortcode |
A length-2 logical vector: whether to use the shortcode
‘[sourcecode lang='lang']’, which can be useful to WordPress.com users
for syntax highlighting of source code and output. The first element
applies to source code, and the second applies to text output. By default,
both are |
action |
Whether to create a new post, update an existing post, or create a new page. |
postid |
If |
publish |
Boolean: publish the post immediately? |
This function will convert the encoding of the post and the title to
UTF-8 internally. If you have additional data to send to WordPress (e.g.
keywords and categories), you may have to manually convert them to the
UTF-8 encoding with the iconv(x, to = 'UTF-8')
function
(especially when using Windows).
William K. Morris, Yihui Xie, and Jared Lander
https://yihui.org/knitr/demo/wordpress/
# see the reference
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.