| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/utils-conversion.R |
| 3 |
\name{knit2wp} |
| 4 |
\alias{knit2wp} |
| 5 |
\title{Knit an R Markdown document and post it to WordPress} |
| 6 |
\usage{ |
| 7 |
knit2wp( |
| 8 |
input, |
| 9 |
title = "A post from knitr", |
| 10 |
..., |
| 11 |
envir = parent.frame(), |
| 12 |
shortcode = FALSE, |
| 13 |
action = c("newPost", "editPost", "newPage"), |
| 14 |
postid, |
| 15 |
publish = TRUE |
| 16 |
) |
| 17 |
} |
| 18 |
\arguments{ |
| 19 |
\item{input}{Filename of the Rmd document.} |
| 20 |
|
| 21 |
\item{title}{Title of the post.} |
| 22 |
|
| 23 |
\item{...}{Other meta information of the post, e.g. \code{categories = c('R', |
| 24 |
'Stats')} and \code{mt_keywords = c('knitr', 'wordpress')}, et cetera.} |
| 25 |
|
| 26 |
\item{envir}{Environment in which code chunks are to be evaluated, for |
| 27 |
example, \code{\link{parent.frame}()}, \code{\link{new.env}()}, or |
| 28 |
\code{\link{globalenv}()}).} |
| 29 |
|
| 30 |
\item{shortcode}{A length-2 logical vector: whether to use the shortcode |
| 31 |
\samp{[sourcecode lang='lang']}, which can be useful to WordPress.com users |
| 32 |
for syntax highlighting of source code and output. The first element |
| 33 |
applies to source code, and the second applies to text output. By default, |
| 34 |
both are \code{FALSE}.} |
| 35 |
|
| 36 |
\item{action}{Whether to create a new post, update an existing post, or |
| 37 |
create a new page.} |
| 38 |
|
| 39 |
\item{postid}{If \code{action} is \code{editPost}, the post id \code{postid} |
| 40 |
must be specified.} |
| 41 |
|
| 42 |
\item{publish}{Boolean: publish the post immediately?} |
| 43 |
} |
| 44 |
\description{ |
| 45 |
This function is a wrapper around the \pkg{RWordPress} package. It compiles |
| 46 |
an R Markdown document to HTML and post the results to WordPress. Please note |
| 47 |
that \pkg{RWordPress} has not been updated for several years, which is |
| 48 |
\href{https://github.com/yihui/knitr/issues/1866}{not a good sign}. For |
| 49 |
blogging with R, you may want to try the \pkg{blogdown} package instead. |
| 50 |
} |
| 51 |
\note{ |
| 52 |
This function will convert the encoding of the post and the title to |
| 53 |
UTF-8 internally. If you have additional data to send to WordPress (e.g. |
| 54 |
keywords and categories), you may have to manually convert them to the |
| 55 |
UTF-8 encoding with the \code{\link{iconv}(x, to = 'UTF-8')} function |
| 56 |
(especially when using Windows). |
| 57 |
} |
| 58 |
\examples{ |
| 59 |
# see the reference |
| 60 |
} |
| 61 |
\references{ |
| 62 |
\url{https://yihui.org/knitr/demo/wordpress/} |
| 63 |
} |
| 64 |
\author{ |
| 65 |
William K. Morris, Yihui Xie, and Jared Lander |
| 66 |
} |