summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--themes/xmin/.gitignore5
-rw-r--r--themes/xmin/LICENSE.md20
-rw-r--r--themes/xmin/README.md28
-rw-r--r--themes/xmin/archetypes/default.md4
-rw-r--r--themes/xmin/exampleSite/config.toml36
-rw-r--r--themes/xmin/exampleSite/content/_index.Rmarkdown24
-rw-r--r--themes/xmin/exampleSite/content/_index.markdown38
-rw-r--r--themes/xmin/exampleSite/content/about.md101
-rw-r--r--themes/xmin/exampleSite/content/note/2017-06-13-a-quick-note.md15
-rw-r--r--themes/xmin/exampleSite/content/note/2017-06-14-another-note.md14
-rw-r--r--themes/xmin/exampleSite/content/post/2015-07-23-lorem-ipsum.md18
-rw-r--r--themes/xmin/exampleSite/content/post/2016-02-14-hello-markdown.md92
-rw-r--r--themes/xmin/exampleSite/layouts/partials/foot_custom.html4
-rw-r--r--themes/xmin/hugo-xmin.Rproj16
-rw-r--r--themes/xmin/images/screenshot.pngbin0 -> 37151 bytes
-rw-r--r--themes/xmin/images/tn.pngbin0 -> 21823 bytes
-rw-r--r--themes/xmin/layouts/404.html5
-rw-r--r--themes/xmin/layouts/_default/list.html20
-rw-r--r--themes/xmin/layouts/_default/single.html12
-rw-r--r--themes/xmin/layouts/_default/terms.html13
-rw-r--r--themes/xmin/layouts/partials/foot_custom.html0
-rw-r--r--themes/xmin/layouts/partials/footer.html9
-rw-r--r--themes/xmin/layouts/partials/head_custom.html0
-rw-r--r--themes/xmin/layouts/partials/header.html20
-rw-r--r--themes/xmin/static/css/fonts.css7
-rw-r--r--themes/xmin/static/css/style.css51
-rw-r--r--themes/xmin/theme.toml12
27 files changed, 564 insertions, 0 deletions
diff --git a/themes/xmin/.gitignore b/themes/xmin/.gitignore
new file mode 100644
index 0000000..ce130a0
--- /dev/null
+++ b/themes/xmin/.gitignore
@@ -0,0 +1,5 @@
1.Rproj.user
2.Rhistory
3.RData
4.Ruserdata
5exampleSite/public
diff --git a/themes/xmin/LICENSE.md b/themes/xmin/LICENSE.md
new file mode 100644
index 0000000..fa77e18
--- /dev/null
+++ b/themes/xmin/LICENSE.md
@@ -0,0 +1,20 @@
1The MIT License (MIT)
2
3Copyright (c) 2017 Yihui Xie
4
5Permission is hereby granted, free of charge, to any person obtaining a copy of
6this software and associated documentation files (the "Software"), to deal in
7the Software without restriction, including without limitation the rights to
8use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all
13copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/themes/xmin/README.md b/themes/xmin/README.md
new file mode 100644
index 0000000..3cd9a40
--- /dev/null
+++ b/themes/xmin/README.md
@@ -0,0 +1,28 @@
1# HUGO XMIN
2
3## _Keep it simple, but not simpler_
4
5**XMin** is a Hugo theme written by [Yihui Xie](https://yihui.name) in about four hours: half an hour was spent on the Hugo templates, and 3.5 hours were spent on styling. The main motivation for writing this theme was to provide a really minimal example to beginners of Hugo templates. This XMin theme contains about 130 lines of code in total, including the code in HTML templates and CSS (also counting empty lines).
6
7
8```bash
9find . -not -path '*/exampleSite/*' \( -name '*.html' -o -name '*.css' \) | xargs wc -l
10```
11
12```
13 5 ./layouts/404.html
14 12 ./layouts/_default/single.html
15 20 ./layouts/_default/list.html
16 13 ./layouts/_default/terms.html
17 0 ./layouts/partials/foot_custom.html
18 0 ./layouts/partials/head_custom.html
19 9 ./layouts/partials/footer.html
20 20 ./layouts/partials/header.html
21 51 ./static/css/style.css
22 7 ./static/css/fonts.css
23 137 total
24```
25
26I can certainly further reduce the code, for example, by eliminating the CSS, but I believe a tiny bit of CSS can greatly improve readability. You cannot really find many CSS frameworks that only contain 50 lines of code.
27
28[![Screenshot](https://github.com/yihui/hugo-xmin/raw/master/images/screenshot.png)](https://xmin.yihui.name)
diff --git a/themes/xmin/archetypes/default.md b/themes/xmin/archetypes/default.md
new file mode 100644
index 0000000..fb98e92
--- /dev/null
+++ b/themes/xmin/archetypes/default.md
@@ -0,0 +1,4 @@
1---
2title: ''
3date: ''
4---
diff --git a/themes/xmin/exampleSite/config.toml b/themes/xmin/exampleSite/config.toml
new file mode 100644
index 0000000..7147426
--- /dev/null
+++ b/themes/xmin/exampleSite/config.toml
@@ -0,0 +1,36 @@
1baseurl = "/"
2languageCode = "en-us"
3title = "A minimal Hugo website"
4theme = "hugo-xmin"
5googleAnalytics = ""
6disqusShortname = ""
7ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]
8footnotereturnlinkcontents = "↩"
9
10[permalinks]
11 post = "/post/:year/:month/:day/:slug/"
12 note = "/note/:year/:month/:day/:slug/"
13
14[[menu.main]]
15 name = "Home"
16 url = "/"
17 weight = 1
18[[menu.main]]
19 name = "About"
20 url = "/about/"
21 weight = 2
22[[menu.main]]
23 name = "Categories"
24 url = "/categories/"
25 weight = 3
26[[menu.main]]
27 name = "Tags"
28 url = "/tags/"
29 weight = 4
30[[menu.main]]
31 name = "Subscribe"
32 url = "/index.xml"
33
34[params]
35 description = "A website built through Hugo and blogdown."
36 footer = "© [Yihui Xie](https://yihui.name) 2017 -- 2019 | [Github](https://github.com/yihui) | [Twitter](https://twitter.com/xieyihui)"
diff --git a/themes/xmin/exampleSite/content/_index.Rmarkdown b/themes/xmin/exampleSite/content/_index.Rmarkdown
new file mode 100644
index 0000000..9819e5d
--- /dev/null
+++ b/themes/xmin/exampleSite/content/_index.Rmarkdown
@@ -0,0 +1,24 @@
1---
2title: Home
3---
4
5[<img src="https://simpleicons.org/icons/github.svg" style="max-width:15%;min-width:40px;float:right;" alt="Github repo" />](https://github.com/yihui/hugo-xmin)
6
7# HUGO XMIN
8
9## _Keep it simple, but not simpler_
10
11**XMin** is a Hugo theme written by [Yihui Xie](https://yihui.name) in about four hours: half an hour was spent on the Hugo templates, and 3.5 hours were spent on styling. The main motivation for writing this theme was to provide a really minimal example to beginners of Hugo templates. This XMin theme contains about 130 lines of code in total, including the code in HTML templates and CSS (also counting empty lines).
12
13```{bash, comment='', echo=2, eval=Sys.which('bash') != '' && .Platform$OS.type != 'windows'}
14cd ../..;
15find . -not -path '*/exampleSite/*' \( -name '*.html' -o -name '*.css' \) | xargs wc -l
16```
17
18I can certainly further reduce the code, for example, by eliminating the CSS, but I believe a tiny bit of CSS can greatly improve readability. You cannot really find many CSS frameworks that only contain 50 lines of code.
19
20Although it is a minimal theme, it is actually fully functional. It supports pages (including the home page), blog posts, a navigation menu, categories, tags, and RSS. With [a little bit customization](https://github.com/yihui/hugo-xmin/blob/master/exampleSite/layouts/partials/foot_custom.html), it can easily support LaTeX math expressions, e.g.,
21
22`$${\sqrt {n}}\left(\left({\frac {1}{n}}\sum _{i=1}^{n}X_{i}\right)-\mu \right)\ {\xrightarrow {d}}\ N\left(0,\sigma ^{2}\right)$$`
23
24All pages not under the root directory of the website are listed below. You can also visit the list page of a single section, e.g., [posts](/post/), or [notes](/note/). See the [About](/about/) page for the usage of this theme.
diff --git a/themes/xmin/exampleSite/content/_index.markdown b/themes/xmin/exampleSite/content/_index.markdown
new file mode 100644
index 0000000..ac2271c
--- /dev/null
+++ b/themes/xmin/exampleSite/content/_index.markdown
@@ -0,0 +1,38 @@
1---
2title: Home
3---
4
5[<img src="https://simpleicons.org/icons/github.svg" style="max-width:15%;min-width:40px;float:right;" alt="Github repo" />](https://github.com/yihui/hugo-xmin)
6
7# HUGO XMIN
8
9## _Keep it simple, but not simpler_
10
11**XMin** is a Hugo theme written by [Yihui Xie](https://yihui.name) in about four hours: half an hour was spent on the Hugo templates, and 3.5 hours were spent on styling. The main motivation for writing this theme was to provide a really minimal example to beginners of Hugo templates. This XMin theme contains about 130 lines of code in total, including the code in HTML templates and CSS (also counting empty lines).
12
13
14```bash
15find . -not -path '*/exampleSite/*' \( -name '*.html' -o -name '*.css' \) | xargs wc -l
16```
17
18```
19 5 ./layouts/404.html
20 12 ./layouts/_default/single.html
21 20 ./layouts/_default/list.html
22 13 ./layouts/_default/terms.html
23 0 ./layouts/partials/foot_custom.html
24 0 ./layouts/partials/head_custom.html
25 9 ./layouts/partials/footer.html
26 20 ./layouts/partials/header.html
27 51 ./static/css/style.css
28 7 ./static/css/fonts.css
29 137 total
30```
31
32I can certainly further reduce the code, for example, by eliminating the CSS, but I believe a tiny bit of CSS can greatly improve readability. You cannot really find many CSS frameworks that only contain 50 lines of code.
33
34Although it is a minimal theme, it is actually fully functional. It supports pages (including the home page), blog posts, a navigation menu, categories, tags, and RSS. With [a little bit customization](https://github.com/yihui/hugo-xmin/blob/master/exampleSite/layouts/partials/foot_custom.html), it can easily support LaTeX math expressions, e.g.,
35
36`$${\sqrt {n}}\left(\left({\frac {1}{n}}\sum _{i=1}^{n}X_{i}\right)-\mu \right)\ {\xrightarrow {d}}\ N\left(0,\sigma ^{2}\right)$$`
37
38All pages not under the root directory of the website are listed below. You can also visit the list page of a single section, e.g., [posts](/post/), or [notes](/note/). See the [About](/about/) page for the usage of this theme.
diff --git a/themes/xmin/exampleSite/content/about.md b/themes/xmin/exampleSite/content/about.md
new file mode 100644
index 0000000..dd83942
--- /dev/null
+++ b/themes/xmin/exampleSite/content/about.md
@@ -0,0 +1,101 @@
1---
2title: About Hugo XMin
3author: Yihui Xie
4---
5
6**XMin** is the first Hugo theme I have designed. The original reason that I wrote it was I needed a minimal example of Hugo themes when I was writing the [**blogdown**](https://github.com/rstudio/blogdown) book. Basically I wanted a simple theme that supports a navigation menu, a home page, other single pages, lists of pages, blog posts, categories, tags, and RSS. That is all. Nothing fancy. In terms of CSS and JavaScript, I really want to keep them minimal. In fact, this theme does not contain any JavaScript code at all, although on this example website I did introduce some JavaScript code (still relatively simple anyway). The theme does not contain any images, either, and is pretty much a plain-text theme.
7
8The theme name "XMin" can be interpreted as "**X**ie's **Min**imal theme" (Xie is my last name) or "e**X**tremely **Min**imal theme".
9
10# config.toml
11
12For this example site, I defined permalinks for two sections, `post` and `note`, so that the links to pages under these directories will contain the date info, e.g., `https://xmin.yihui.name/post/2016/02/14/a-plain-markdown-post/`. This is optional, and it is up to your personal taste of URLs.
13
14```
15[permalinks]
16 post = "/post/:year/:month/:day/:slug/"
17 note = "/note/:year/:month/:day/:slug/"
18```
19
20You can define the menu through `menu.main`, e.g.,
21
22```
23[[menu.main]]
24 name = "Home"
25 url = "/"
26 weight = 1
27[[menu.main]]
28 name = "About"
29 url = "/about/"
30 weight = 2
31[[menu.main]]
32 name = "Categories"
33 url = "/categories/"
34 weight = 3
35[[menu.main]]
36 name = "Tags"
37 url = "/tags/"
38 weight = 4
39[[menu.main]]
40 name = "Subscribe"
41 url = "/index.xml"
42```
43
44Alternatively, you can add `menu: main` to the YAML metadata of any of your pages, so that these pages will appear in the menu.
45
46The page footer can be defined in `.Params.footer`, and the text is treated as Markdown, e.g.,
47
48```
49[params]
50 footer = "&copy; [Yihui Xie](https://yihui.name) 2017"
51```
52
53# Custom layouts
54
55There are two layout files under `layouts/partials/` that you may want to override: `head_custom.html` and `foot_custom.html`. This is how you inject arbitrary HTML code to the head and foot areas. For example, this site has a file `layouts/partials/foot_custom.html` to support LaTeX math via MathJax and center images automatically:
56
57```html
58<script src="//yihui.name/js/math-code.js"></script>
59<script async src="//cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
60</script>
61
62<script async src="//yihui.name/js/center-img.js"></script>
63```
64
65You can certainly enable highlight.js for syntax highlighting by yourself through `head_custom.html` and `foot_custom.html` if you want.
66
67If you do not like the default fonts (e.g., `Palatino`), you may provide your own `static/css/fonts.css` under the root directory of your website to override the `fonts.css` in the theme.
68
69# Other features
70
71I could have added more features to this theme, but I decided not to, since I have no intention to make this theme feature-rich. However, I will teach you how. I have prepared several examples via pull requests at https://github.com/yihui/hugo-xmin/pulls, so that you can see the implementations of these features when you check out the diffs in the pull requests. For example, you can:
72
73- [Enable Google Analytics](https://github.com/yihui/hugo-xmin/pull/3)
74
75- [Enable Disqus comments](https://github.com/yihui/hugo-xmin/pull/4)
76
77- [Enable highlight.js for syntax highlighting of code blocks](https://github.com/yihui/hugo-xmin/pull/5)
78
79- [Display categories and tags on a page](https://github.com/yihui/hugo-xmin/pull/2)
80
81- [Add a table of contents](https://github.com/yihui/hugo-xmin/pull/7)
82
83- [Add a link in the footer of each page to "Edit this page" on Github](https://github.com/yihui/hugo-xmin/pull/6)
84
85To fully understand these examples, you have to read [the section on Hugo templates](https://bookdown.org/yihui/blogdown/templates.html) in the **blogdown** book.
86
87# Design philosophy
88
89Lastly, a few words about my design philosophy for this theme: I have been relying on existing frameworks like Bootstrap for years since I'm not really a designer, and I was always scared by the complexity of CSS.
90
91When I started writing this theme, I asked myself, "_What if I just write from scratch?_" No Bootstrap. No Normalize.css. I don't care about IE (life could be so much easier without IE) or inconsistencies among browsers (for personal websites). As long as the theme looks okay in Chrome, Firefox, and Safari, I'm done. Thanks to the simplicity of Markdown, you cannot really produce very complicated HTML, and I think styling the HTML output from Markdown is much simpler than general HTML documents. For example, I do not need to care much about form elements like textareas or buttons.
92
93After I finished this theme, I started to wonder why I'd need `normalize.css` at all (it sounds like a religious belief). The default appearance of modern browsers actually looks pretty good in my eyes, after I tweak the typeface a little bit.
94
95Compared to inconsistencies across browsers, I care much more about these properties of HTML elements:
96
97- Tables should always be centered, and striped tables are easier to read especially when they are wide. Tables should not have vertical borders.
98- An image should be centered if it is the only child element of a paragraph.
99- The `max-width` of images, videos, and iframes should be `100%`.
100
101I hope you can enjoy this theme. The source code is [on Github](https://github.com/yihui/hugo-xmin). Happy hacking!
diff --git a/themes/xmin/exampleSite/content/note/2017-06-13-a-quick-note.md b/themes/xmin/exampleSite/content/note/2017-06-13-a-quick-note.md
new file mode 100644
index 0000000..9d855a4
--- /dev/null
+++ b/themes/xmin/exampleSite/content/note/2017-06-13-a-quick-note.md
@@ -0,0 +1,15 @@
1---
2title: A Quick Note on Two Beautiful Websites
3author: Yihui Xie
4date: '2017-06-13'
5categories:
6 - Example
7slug: a-quick-note
8---
9
10To me, the two most impressive websites based on **blogdown** are:
11
121. [Rob J Hyndman](https://robjhyndman.com)'s personal website.
131. [Live Free or Dichotomize](http://livefreeordichotomize.com) by Lucy and Nick _et al_.
14
15I'm sure there will be more.
diff --git a/themes/xmin/exampleSite/content/note/2017-06-14-another-note.md b/themes/xmin/exampleSite/content/note/2017-06-14-another-note.md
new file mode 100644
index 0000000..16f41de
--- /dev/null
+++ b/themes/xmin/exampleSite/content/note/2017-06-14-another-note.md
@@ -0,0 +1,14 @@
1---
2title: Another Note on A blogdown Tutorial
3author: Yihui Xie
4date: '2017-06-14'
5categories:
6 - Example
7tags:
8 - Tutorial
9slug: another-note
10---
11
12I just discovered [an awesome tutorial](https://apreshill.rbind.io/post/up-and-running-with-blogdown/) on **blogdown** written by Alison. I have to admit this is _the_ best **blogdown** tutorial I have seen so far.
13
14![](https://apreshill.rbind.io/img/posts/2017-06-12-up-and-running-with-blogdown/blogdown-signpost-4.png)
diff --git a/themes/xmin/exampleSite/content/post/2015-07-23-lorem-ipsum.md b/themes/xmin/exampleSite/content/post/2015-07-23-lorem-ipsum.md
new file mode 100644
index 0000000..ef58622
--- /dev/null
+++ b/themes/xmin/exampleSite/content/post/2015-07-23-lorem-ipsum.md
@@ -0,0 +1,18 @@
1---
2title: Lorem Ipsum
3date: '2015-07-23'
4categories:
5 - Example
6tags:
7 - Markdown
8---
9
10**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.
11
12Quisque 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.
13
14> Sed luctus volutpat sem in dapibus. Ut pellentesque vitae magna ac mattis. Sed vestibulum, nulla at condimentum semper, magna quam posuere dui, quis sagittis enim nisi eget ex. Vivamus tempor erat a sem dapibus porta. Fusce varius dapibus tempus. Nam bibendum dignissim fringilla. Phasellus eu justo facilisis, ullamcorper urna in, feugiat mauris. Quisque dignissim purus vitae ullamcorper scelerisque. Sed at magna at nisi consequat euismod. Curabitur justo ex, efficitur in fermentum luctus, tincidunt nec lectus. Aliquam a neque metus. Etiam nulla nunc, tristique vitae accumsan ullamcorper, placerat eget nunc. Cras porta eleifend dolor maximus molestie. Etiam vitae pellentesque turpis, quis accumsan ligula. Mauris auctor, nisi nec ullamcorper pulvinar, libero magna sagittis enim, sollicitudin dignissim urna justo et tortor.
15
16Morbi non sem euismod, suscipit purus id, gravida velit. Quisque mollis luctus ligula non suscipit. Curabitur massa arcu, aliquam ac dolor a, pellentesque dignissim dui. Donec at vestibulum magna. Quisque fermentum, tortor id sodales egestas, ligula ligula interdum ipsum, et volutpat elit massa vitae nibh. Morbi eleifend libero quis pretium viverra. Etiam congue, velit ac vestibulum finibus, velit nibh fringilla purus, eu semper dui est eu nunc. Etiam feugiat scelerisque diam vitae sodales. Etiam luctus in urna eu lobortis. Nam vestibulum eros et nibh elementum ullamcorper. Nam tristique porttitor orci, nec pretium est vestibulum at. Quisque posuere semper orci, vel semper justo commodo sed. Nullam accumsan risus rhoncus fringilla porta. Morbi interdum condimentum pharetra. Donec eu elit quam. Vivamus eleifend posuere mi, vel accumsan urna sollicitudin ut.
17
18Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla nec nunc felis. Sed bibendum vel leo id semper. Maecenas vitae iaculis ante. Nam ut tempor est, eu molestie augue. Quisque tincidunt sagittis odio sed tristique. Aenean et felis quis mi viverra consequat.
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?
diff --git a/themes/xmin/exampleSite/layouts/partials/foot_custom.html b/themes/xmin/exampleSite/layouts/partials/foot_custom.html
new file mode 100644
index 0000000..270a44d
--- /dev/null
+++ b/themes/xmin/exampleSite/layouts/partials/foot_custom.html
@@ -0,0 +1,4 @@
1<script src="//yihui.name/js/math-code.js"></script>
2<script async src="//mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script>
3
4<script async src="//yihui.name/js/center-img.js"></script>
diff --git a/themes/xmin/hugo-xmin.Rproj b/themes/xmin/hugo-xmin.Rproj
new file mode 100644
index 0000000..d64e28b
--- /dev/null
+++ b/themes/xmin/hugo-xmin.Rproj
@@ -0,0 +1,16 @@
1Version: 1.0
2
3RestoreWorkspace: Default
4SaveWorkspace: Default
5AlwaysSaveHistory: Default
6
7EnableCodeIndexing: Yes
8UseSpacesForTab: Yes
9NumSpacesForTab: 2
10Encoding: UTF-8
11
12RnwWeave: knitr
13LaTeX: pdfLaTeX
14
15AutoAppendNewline: Yes
16StripTrailingWhitespace: Yes
diff --git a/themes/xmin/images/screenshot.png b/themes/xmin/images/screenshot.png
new file mode 100644
index 0000000..3df0a14
--- /dev/null
+++ b/themes/xmin/images/screenshot.png
Binary files differ
diff --git a/themes/xmin/images/tn.png b/themes/xmin/images/tn.png
new file mode 100644
index 0000000..389a20c
--- /dev/null
+++ b/themes/xmin/images/tn.png
Binary files differ
diff --git a/themes/xmin/layouts/404.html b/themes/xmin/layouts/404.html
new file mode 100644
index 0000000..c2e4e40
--- /dev/null
+++ b/themes/xmin/layouts/404.html
@@ -0,0 +1,5 @@
1{{ partial "header.html" . }}
2
3404 NOT FOUND
4
5{{ partial "footer.html" . }}
diff --git a/themes/xmin/layouts/_default/list.html b/themes/xmin/layouts/_default/list.html
new file mode 100644
index 0000000..06b290a
--- /dev/null
+++ b/themes/xmin/layouts/_default/list.html
@@ -0,0 +1,20 @@
1{{ partial "header.html" . }}
2
3{{if not .IsHome }}
4<h1>{{ .Title | markdownify }}</h1>
5{{ end }}
6
7{{ .Content }}
8
9<ul>
10 {{ $pages := .Pages }}
11 {{ if .IsHome }}{{ $pages = .Site.RegularPages }}{{ end }}
12 {{ range (where $pages "Section" "!=" "") }}
13 <li>
14 <span class="date">{{ .Date.Format "2006/01/02" }}</span>
15 <a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
16 </li>
17 {{ end }}
18</ul>
19
20{{ partial "footer.html" . }}
diff --git a/themes/xmin/layouts/_default/single.html b/themes/xmin/layouts/_default/single.html
new file mode 100644
index 0000000..de3f121
--- /dev/null
+++ b/themes/xmin/layouts/_default/single.html
@@ -0,0 +1,12 @@
1{{ partial "header.html" . }}
2<div class="article-meta">
3<h1><span class="title">{{ .Title | markdownify }}</span></h1>
4{{ with .Params.author }}<h2 class="author">{{ . }}</h2>{{ end }}
5{{ if (gt .Params.date 0) }}<h2 class="date">{{ .Date.Format "2006/01/02" }}</h2>{{ end }}
6</div>
7
8<main>
9{{ .Content }}
10</main>
11
12{{ partial "footer.html" . }}
diff --git a/themes/xmin/layouts/_default/terms.html b/themes/xmin/layouts/_default/terms.html
new file mode 100644
index 0000000..71f47e7
--- /dev/null
+++ b/themes/xmin/layouts/_default/terms.html
@@ -0,0 +1,13 @@
1{{ partial "header.html" . }}
2
3<h1>{{ .Title }}</h1>
4
5<ul class="terms">
6 {{ range .Data.Terms }}
7 <li>
8 <a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a> ({{ .Count }})
9 </li>
10 {{ end }}
11</ul>
12
13{{ partial "footer.html" . }}
diff --git a/themes/xmin/layouts/partials/foot_custom.html b/themes/xmin/layouts/partials/foot_custom.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/themes/xmin/layouts/partials/foot_custom.html
diff --git a/themes/xmin/layouts/partials/footer.html b/themes/xmin/layouts/partials/footer.html
new file mode 100644
index 0000000..3f46ea5
--- /dev/null
+++ b/themes/xmin/layouts/partials/footer.html
@@ -0,0 +1,9 @@
1 <footer>
2 {{ partial "foot_custom.html" . }}
3 {{ with .Site.Params.footer }}
4 <hr/>
5 {{ . | markdownify }}
6 {{ end }}
7 </footer>
8 </body>
9</html>
diff --git a/themes/xmin/layouts/partials/head_custom.html b/themes/xmin/layouts/partials/head_custom.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/themes/xmin/layouts/partials/head_custom.html
diff --git a/themes/xmin/layouts/partials/header.html b/themes/xmin/layouts/partials/header.html
new file mode 100644
index 0000000..4f431eb
--- /dev/null
+++ b/themes/xmin/layouts/partials/header.html
@@ -0,0 +1,20 @@
1<!DOCTYPE html>
2<html lang="{{ .Site.LanguageCode }}">
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <title>{{ .Title }} | {{ .Site.Title }}</title>
7 <link rel="stylesheet" href="{{ "/css/style.css" | relURL }}" />
8 <link rel="stylesheet" href="{{ "/css/fonts.css" | relURL }}" />
9 {{ partial "head_custom.html" . }}
10 </head>
11
12 <body>
13 <nav>
14 <ul class="menu">
15 {{ range .Site.Menus.main }}
16 <li><a href="{{ .URL | relURL }}">{{ .Name }}</a></li>
17 {{ end }}
18 </ul>
19 <hr/>
20 </nav>
diff --git a/themes/xmin/static/css/fonts.css b/themes/xmin/static/css/fonts.css
new file mode 100644
index 0000000..8ffcecd
--- /dev/null
+++ b/themes/xmin/static/css/fonts.css
@@ -0,0 +1,7 @@
1body {
2 font-family: Optima, Candara, Calibri, Arial, sans-serif;
3}
4code {
5 font-family: "Lucida Console", Monaco, monospace;
6 font-size: 85%;
7}
diff --git a/themes/xmin/static/css/style.css b/themes/xmin/static/css/style.css
new file mode 100644
index 0000000..4dc3ae4
--- /dev/null
+++ b/themes/xmin/static/css/style.css
@@ -0,0 +1,51 @@
1body {
2 max-width: 800px;
3 margin: auto;
4 padding: 1em;
5 line-height: 1.5em;
6}
7
8/* header and footer areas */
9.menu { padding: 0; }
10.menu li { display: inline-block; }
11.article-meta, .menu a {
12 text-decoration: none;
13 background: #eee;
14 padding: 5px;
15 border-radius: 5px;
16}
17.menu, .article-meta, footer { text-align: center; }
18.title { font-size: 1.1em; }
19footer a { text-decoration: none; }
20hr {
21 border-style: dashed;
22 color: #ddd;
23}
24
25/* code */
26pre {
27 border: 1px solid #ddd;
28 box-shadow: 5px 5px 5px #eee;
29 padding: 1em;
30 overflow-x: auto;
31}
32code { background: #f9f9f9; }
33pre code { background: none; }
34
35/* misc elements */
36img, iframe, video { max-width: 100%; }
37main { hyphens: auto; }
38blockquote {
39 background: #f9f9f9;
40 border-left: 5px solid #ccc;
41 padding: 3px 1em 3px;
42}
43
44table {
45 margin: auto;
46 border-top: 1px solid #666;
47 border-bottom: 1px solid #666;
48}
49table thead th { border-bottom: 1px solid #ddd; }
50th, td { padding: 5px; }
51thead, tfoot, tr:nth-child(even) { background: #eee; }
diff --git a/themes/xmin/theme.toml b/themes/xmin/theme.toml
new file mode 100644
index 0000000..8733afd
--- /dev/null
+++ b/themes/xmin/theme.toml
@@ -0,0 +1,12 @@
1name = "XMin"
2license = "MIT"
3licenselink = "https://github.com/yihui/hugo-xmin/blob/master/LICENSE.md"
4description = "eXtremely Minimal Hugo theme: about 150 lines of code in total, including HTML and CSS"
5homepage = "https://xmin.yihui.name"
6tags = ["minimal", "blog", "personal", "clean", "simple", "starter", "minimalist"]
7features = ["blog"]
8min_version = "0.18"
9
10[author]
11 name = "Yihui Xie"
12 homepage = "https://yihui.name"