about summary refs log tree commit diff stats
path: root/themes/xmin/exampleSite/content/post/2016-02-14-hello-markdown.md
diff options
context:
space:
mode:
authorAlan Pearce2020-01-10 19:55:06 +0100
committerAlan Pearce2020-01-10 19:55:06 +0100
commiteea42a5b1b05fbbdc9f33df41576de0232fcbd4d (patch)
tree942ce4381278d49870b4016784ea2bfdfc1d66b6 /themes/xmin/exampleSite/content/post/2016-02-14-hello-markdown.md
parentd93409097b7a4d68c5660446bfb574ac673040a5 (diff)
parent7befbf2f991e217aa4d52615f9f430cae30897f5 (diff)
downloadwebsite-eea42a5b1b05fbbdc9f33df41576de0232fcbd4d.tar.xz
website-eea42a5b1b05fbbdc9f33df41576de0232fcbd4d.zip
Merge commit '7befbf2f991e217aa4d52615f9f430cae30897f5' as 'themes/xmin'
Diffstat (limited to 'themes/xmin/exampleSite/content/post/2016-02-14-hello-markdown.md')
-rw-r--r--themes/xmin/exampleSite/content/post/2016-02-14-hello-markdown.md92
1 files changed, 92 insertions, 0 deletions
diff --git a/themes/xmin/exampleSite/content/post/2016-02-14-hello-markdown.md b/themes/xmin/exampleSite/content/post/2016-02-14-hello-markdown.md new file mode 100644 index 0000000..e06e31a --- /dev/null +++ b/themes/xmin/exampleSite/content/post/2016-02-14-hello-markdown.md
@@ -0,0 +1,92 @@
1---
2title: A Plain Markdown Post
3author: Yihui Xie
4date: '2016-02-14'
5categories:
6 - Example
7 - Hugo
8tags:
9 - blogdown
10 - Markdown
11 - MathJax
12 - Pandoc
13 - RStudio
14---
15
16This sample post is mainly for [**blogdown**](https://github.com/rstudio/blogdown) users. If you do not use **blogdown**, you can skip the first section.
17
18# 1. Markdown or R Markdown
19
20This is a post written in plain Markdown (`*.md`) instead of R Markdown (`*.Rmd`). The major differences are:
21
221. You cannot run any R code in a plain Markdown document, whereas in an R Markdown document, you can embed R code chunks (```` ```{r} ````);
232. A plain Markdown post is rendered through [Blackfriday](https://gohugo.io/overview/configuration/), and an R Markdown document is compiled by [**rmarkdown**](http://rmarkdown.rstudio.com) and [Pandoc](http://pandoc.org).
24
25There are many differences in syntax between Blackfriday's Markdown and Pandoc's Markdown. For example, you can write a task list with Blackfriday but not with Pandoc:
26
27- [x] Write an R package.
28- [ ] Write a book.
29- [ ] ...
30- [ ] Profit!
31
32Similarly, Blackfriday does not support LaTeX math and Pandoc does. I have added the MathJax support to this theme ([hugo-xmin](https://github.com/yihui/hugo-xmin)) but there is a caveat for plain Markdown posts: you have to include math expressions in a pair of backticks (inline: `` `$ $` ``; display style: `` `$$ $$` ``), e.g., `$S_n = \sum_{i=1}^n X_i$`.^[This is because we have to protect the math expressions from being interpreted as Markdown.] For R Markdown posts, you do not need the backticks, because Pandoc can identify and process math expressions.
33
34When creating a new post, you have to decide whether the post format is Markdown or R Markdown, and this can be done via the `rmd` argument of the function `blogdown::new_post()`, e.g.
35
36```r
37blogdown::new_post("Post Title", rmd = FALSE)
38```
39
40Actually I recommend you to use the RStudio addin "New Post" instead:
41
42![RStudio addin New Post](https://bookdown.org/yihui/blogdown/images/new-post.png)
43
44# 2. Sample Text
45
46## Second-level header
47
48### Third-level header
49
50#### Fourth-level header
51
52A paragraph (with a footnote):
53
54**Lorem ipsum** dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore _magna aliqua_. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.^[I'm sure you are bored by the text here.]
55
56A blockquote (a gray bar at the left and lightgray background):
57
58> Quisque mattis volutpat lorem vitae feugiat. Praesent porta est quis porta imperdiet. Aenean porta, mi non cursus volutpat, mi est mollis libero, id suscipit orci urna a augue. In fringilla euismod lacus, vitae tristique massa ultricies vitae. Mauris accumsan ligula tristique, viverra nulla sed, porta sapien. Vestibulum facilisis nec nisl blandit convallis. Maecenas venenatis porta malesuada. Ut ac erat tortor. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla sodales quam sit amet tincidunt egestas. In et turpis at orci vestibulum ullamcorper. Aliquam sed ante libero. Sed hendrerit arcu lacus.
59
60Some code (with a drop-shadow effect):
61
62```js
63(function() {
64 var quotes = document.getElementsByTagName('blockquote'), i, quote;
65 for (i = 0; i < quotes.length; i++) {
66 quote = quotes[i];
67 var n = quote.children.length;
68 if (n === 0) continue;
69 var el = quote.children[n - 1];
70 if (!el || el.nodeName !== 'P') continue;
71 // right-align a quote footer if it starts with ---
72 if (/^—/.test(el.textContent)) el.style.textAlign = 'right';
73 }
74})();
75```
76
77A table (centered by default):
78
79| Sepal.Length| Sepal.Width| Petal.Length| Petal.Width|Species |
80|------------:|-----------:|------------:|-----------:|:-------|
81| 5.1| 3.5| 1.4| 0.2|setosa |
82| 4.9| 3.0| 1.4| 0.2|setosa |
83| 4.7| 3.2| 1.3| 0.2|setosa |
84| 4.6| 3.1| 1.5| 0.2|setosa |
85| 5.0| 3.6| 1.4| 0.2|setosa |
86| 5.4| 3.9| 1.7| 0.4|setosa |
87
88An image (automatically centered when it is appropriate):
89
90![Happy Elmo](https://slides.yihui.name/gif/happy-elmo.gif)
91
92Looks good?