From 81d293956ac0f1b23fcb00eb6ea9b83a39e41874 Mon Sep 17 00:00:00 2001 From: ds4ci Date: Sat, 2 Jul 2016 16:32:51 -0700 Subject: [PATCH] New post - WordPress via RMarkdown --- R/WordPressPostsViaRMarkdown.Rmd | 38 +++++++- R/WordPressPostsViaRMarkdown.md | 83 ++++++++++++++++++ .../pressure-1.png | Bin 0 -> 3744 bytes 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 R/WordPressPostsViaRMarkdown.md create mode 100644 R/WordPressPostsViaRMarkdown_files/figure-markdown_phpextra+backtick_code_blocks/pressure-1.png diff --git a/R/WordPressPostsViaRMarkdown.Rmd b/R/WordPressPostsViaRMarkdown.Rmd index 36db7da..e1a1415 100644 --- a/R/WordPressPostsViaRMarkdown.Rmd +++ b/R/WordPressPostsViaRMarkdown.Rmd @@ -2,12 +2,48 @@ title: "WordPress Posts via R Markdown" author: "Jim Porzak" date: "July 2, 2016" -output: html_document +output: + md_document: + variant: markdown_phpextra+backtick_code_blocks --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` +I'm totally (re-)inspired with RMarkdown at useR! 2016. A lot going on including bookdown and markdown documents. The latter making WordPress blogging reasonable. Here is my first R Markdown generated post. + +BTW, I'm putting the .Rmd's up on my [GitHub here](https://github.com/ds4ci/DS4CI-Posts) + +The trick is WordPress will optionally accept .md files as input to the blog post edit window. To enable, follow the directions on the [WordPress Markdown page](http://en.support.wordpress.com/markdown/). + +R Markdown can produce plain markdown files with variants for different dialects. See the [RStudio Markdown Documents page](http://rmarkdown.rstudio.com/markdown_document_format.html) + +For WordPress, the YAML output parameter should read +```{} +output: + md_document: + variant: markdown_phpextra+backtick_code_blocks +``` + +The workflow is to knit your .Rmd, then copy the generated markdown and paste into your WordPress Blog Posts|Add|HTML tab. + +There are two gotchas: + +* "Note however that if you have embedded plots or other images you’ll need to upload them separately and fix up their URLs to point to the uploaded location." (from above RStudio page) +* WordPress does not seem to pick up .md title in its Title box. You will need to manually cut & paste the title. + +# Default RStudio Boilerplate +As an example we use the RStudio boilerplate. The workflow is: + +1. RStudio: Knit the `.Rmd` +1. WordPress|Dashboard|Media: Add image(s) from the `_files` folder to the WordPress Media Library. +1. WordPress|Dashboard|Posts|Add New: Copy the md text from RStudio & paste into **HTML** tab. +1. Copy title text from md to Text & delete title lines from the body. +1. For each image placeholder pointing to R project folder: + * Delete image placeholder + * Insert `...whatever...` +1. Don't forget to select categories and add tags. +1. WordPress: Publish & View Post ## R Markdown diff --git a/R/WordPressPostsViaRMarkdown.md b/R/WordPressPostsViaRMarkdown.md new file mode 100644 index 0000000..93a3bce --- /dev/null +++ b/R/WordPressPostsViaRMarkdown.md @@ -0,0 +1,83 @@ +I'm totally (re-)inspired with RMarkdown at useR! 2016. A lot going on +including bookdown and markdown documents. The latter making WordPress +blogging reasonable. Here is my first R Markdown generated post. + +BTW, I'm putting the .Rmd's up on my [GitHub +here](https://github.com/ds4ci/DS4CI-Posts) + +The trick is WordPress will optionally accept .md files as input to the +blog post edit window. To enable, follow the directions on the +[WordPress Markdown page](http://en.support.wordpress.com/markdown/). + +R Markdown can produce plain markdown files with variants for different +dialects. See the [RStudio Markdown Documents +page](http://rmarkdown.rstudio.com/markdown_document_format.html) + +For WordPress, the YAML output parameter should read + + output: + md_document: + variant: markdown_phpextra+backtick_code_blocks + +The workflow is to knit your .Rmd, then copy the generated markdown and +paste into your WordPress Blog Posts|Add|HTML tab. + +There are two gotchas: + +- "Note however that if you have embedded plots or other images you’ll + need to upload them separately and fix up their URLs to point to the + uploaded location." (from above RStudio page) +- WordPress does not seem to pick up .md title in its Title box. You + will need to manually cut & paste the title. + +Default RStudio Boilerplate {#default-rstudio-boilerplate} +=========================== + +As an example we use the RStudio boilerplate. The workflow is: + +1. RStudio: Knit the `.Rmd` +2. WordPress|Dashboard|Media: Add image(s) from the `_files` + folder to the WordPress Media Library. +3. WordPress|Dashboard|Posts|Add New: Copy the md text from RStudio & + paste into **HTML** tab. +4. Copy title text from md to Text & delete title lines from the body. +5. For each image placeholder pointing to R project folder: + - Delete image placeholder + - Insert + `...whatever...` + +6. Don't forget to select categories and add tags. +7. WordPress: Publish & View Post + +R Markdown {#r-markdown} +---------- + +This is an R Markdown document. Markdown is a simple formatting syntax +for authoring HTML, PDF, and MS Word documents. For more details on +using R Markdown see . + +When you click the **Knit** button a document will be generated that +includes both content as well as the output of any embedded R code +chunks within the document. You can embed an R code chunk like this: + +``` r +summary(cars) +``` + + ## speed dist + ## Min. : 4.0 Min. : 2.00 + ## 1st Qu.:12.0 1st Qu.: 26.00 + ## Median :15.0 Median : 36.00 + ## Mean :15.4 Mean : 42.98 + ## 3rd Qu.:19.0 3rd Qu.: 56.00 + ## Max. :25.0 Max. :120.00 + +Including Plots {#including-plots} +--------------- + +You can also embed plots, for example: + +![](WordPressPostsViaRMarkdown_files/figure-markdown_phpextra+backtick_code_blocks/pressure-1.png) + +Note that the `echo = FALSE` parameter was added to the code chunk to +prevent printing of the R code that generated the plot. diff --git a/R/WordPressPostsViaRMarkdown_files/figure-markdown_phpextra+backtick_code_blocks/pressure-1.png b/R/WordPressPostsViaRMarkdown_files/figure-markdown_phpextra+backtick_code_blocks/pressure-1.png new file mode 100644 index 0000000000000000000000000000000000000000..c092055f2d496ba61e9f3073c00bd2087bd1a77b GIT binary patch literal 3744 zcmds4cTiL57LOQdLJ$E#L6EY5NQqd0NC_$eYfz-C6cLHUm7<80gc714O@g|FA|@(} zC`fS;5DmQ-6G0FOgqnb1Nq|6rfaG1=owqx)Z|3dW_s5%gcg~&jednBe?sw1c{Jw8) zg8eCLN%39cAP`8>*5O_AS4X9@HFH%9}uyJo{3CzC)tm=#HaZ9JLhciPdH(6D0PI!MOnR~l;_c^~o z&cnD(?fPmYO=IBuZF7@y#|F70E{r$Y^0p;+jJh6J%uo;q>a^*{Bh9QRS}gB+Y2YCu zju-Xpk^DZaEcLg!)TKoo?;~TBgk7vf$sV~~>eMw9k&JO#0(o3` zYeQRucf9TU(a5<|_|vFFl}E0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