README.md

rmd2wp Package

The idea of this package is that you should be able to post your .Rmd files directly to your Wordpress blog without having to mess with uploading any files, modifying any content/code afterwards, etc. This is very much a tool created to make my life easier, eventually it could be a tool that others might use, but it's definitely not there yet. I found a couple attempts to do this (knit2wp.com and knit2wp), but neither worked out-of-the-box.

postToBlog() function

This is function is written so that all you need to pass it is an .Rmd and a post title. You can also specify post categories and tags. The function also has a toggle for table of contents (toc=TRUE), which will create a table of contents based on h1-h3 tags (Generated by #,##,### in RMarkdown). If another post or page has the same title as the document, it will automatically update it, rather than create a new post/page. There are other options to generate a tweet from your twitter account, and use a link shortener (Bit.ly) also.

Back to top

Example

# Create New Wordpress Post from file
postToBlog.dev('/path/to/file/your-markdown-file.Rmd',
               categories=c('Category 1','Category 2'),
               tags=c('tag 1','tag 2', 'tag 3'),
               syntax.highlighter = 'Syntax Highlighter Evolved',
               type='CreateOrReplace',
               publish=TRUE,
               createTweet=TRUE,
               useURLShortener=TRUE)

Future Plans

If you specify categories that are not defined on the Wordpress site, they are currently omitted. I'd like to create them, but they are not currently supported. Language support other than R and Python will be added soon.

More Resources

Back to top



rweyant/rmd2wp documentation built on May 28, 2019, 10:43 a.m.