Skip to content

Commit c3e428e

Browse files
committed
github md now to yaml metadata
1 parent eb35f32 commit c3e428e

File tree

6 files changed

+25
-38
lines changed

6 files changed

+25
-38
lines changed

rmarkdown_example/test.Rmd

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: "Trying Rmarkdown"
33
author: "Ben Best"
44
date: "August 1, 2014"
55
output:
6+
md_document:
7+
variant: markdown_github
68
pdf_document:
79
fig_caption: yes
810
number_sections: yes
@@ -55,19 +57,17 @@ plot(cars)
5557

5658
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
5759

58-
## Render Markdown
60+
## Github Markdown
5961

60-
To get github friendly Markdown document for cleanly tracking changes to document in Github, use this command in the console (not within the document).
62+
To get github friendly Markdown document for cleanly tracking changes to document in Github, put the following output first:
6163

62-
```{r, eval=FALSE}
63-
library(rmarkdown)
64-
render(
65-
'test.Rmd',
66-
md_document(
67-
'markdown_github',
68-
preserve_yaml=F,
69-
toc=T))
7064
```
65+
output:
66+
md_document:
67+
variant: "markdown_github"
68+
```
69+
70+
NOTE: You need to run this **LAST** though, since knitting other formats wipes out the `test_files` directory. To return to the Knit button having other options (HTML, PDF, Word), move this output type below the first option.
7171

7272
## References {-}
7373
<!-- placeholder for References in toc --!>

rmarkdown_example/test.docx

22 Bytes
Binary file not shown.

rmarkdown_example/test.html

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ <h4 class="date"><em>August 1, 2014</em></h4>
6363
<li><a href="#introduction">Introduction</a></li>
6464
<li><a href="#food-provision-fisheries"><span class="toc-section-number">0.1</span> Food Provision: Fisheries</a></li>
6565
<li><a href="#default-rmarkdown"><span class="toc-section-number">0.2</span> Default Rmarkdown</a></li>
66-
<li><a href="#render-markdown"><span class="toc-section-number">0.3</span> Render Markdown</a></li>
66+
<li><a href="#github-markdown"><span class="toc-section-number">0.3</span> Github Markdown</a></li>
6767
<li><a href="#references">References</a></li>
6868
</ul>
6969
</div>
@@ -104,16 +104,13 @@ <h2><span class="header-section-number">0.2</span> Default Rmarkdown</h2>
104104
</div>
105105
<p>Note that the <code>echo = FALSE</code> parameter was added to the code chunk to prevent printing of the R code that generated the plot.</p>
106106
</div>
107-
<div id="render-markdown" class="section level2">
108-
<h2><span class="header-section-number">0.3</span> Render Markdown</h2>
109-
<p>To get github friendly Markdown document for cleanly tracking changes to document in Github, use this command in the console (not within the document).</p>
110-
<pre class="r"><code>library(rmarkdown)
111-
render(
112-
'test.Rmd',
113-
md_document(
114-
'markdown_github',
115-
preserve_yaml=F,
116-
toc=T))</code></pre>
107+
<div id="github-markdown" class="section level2">
108+
<h2><span class="header-section-number">0.3</span> Github Markdown</h2>
109+
<p>To get github friendly Markdown document for cleanly tracking changes to document in Github, put the following output first:</p>
110+
<pre><code>output:
111+
md_document:
112+
variant: &quot;markdown_github&quot;</code></pre>
113+
<p>NOTE: You need to run this <strong>LAST</strong> though, since knitting other formats wipes out the <code>test_files</code> directory. To return to the Knit button having other options (HTML, PDF, Word), move this output type below the first option.</p>
117114
</div>
118115
<div id="references" class="section level2 unnumbered">
119116
<h2>References</h2>

rmarkdown_example/test.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
- Introduction
2-
- Food Provision: Fisheries
3-
- Default Rmarkdown
4-
- Render Markdown
5-
- References
6-
71
Introduction
82
------------
93

@@ -50,20 +44,16 @@ You can also embed plots, for example:
5044

5145
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
5246

53-
Render Markdown
47+
Github Markdown
5448
---------------
5549

56-
To get github friendly Markdown document for cleanly tracking changes to document in Github, use this command in the console (not within the document).
50+
To get github friendly Markdown document for cleanly tracking changes to document in Github, put the following output first:
5751

58-
``` {.r}
59-
library(rmarkdown)
60-
render(
61-
'test.Rmd',
62-
md_document(
63-
'markdown_github',
64-
preserve_yaml=F,
65-
toc=T))
66-
```
52+
output:
53+
md_document:
54+
variant: "markdown_github"
55+
56+
NOTE: You need to run this **LAST** though, since knitting other formats wipes out the `test_files` directory. To return to the Knit button having other options (HTML, PDF, Word), move this output type below the first option.
6757

6858
References
6959
----------

rmarkdown_example/test.pdf

-1.11 KB
Binary file not shown.
21.2 KB
Loading

0 commit comments

Comments
 (0)