aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--README.md23
-rw-r--r--_posts/2021-04-07-plain.md (renamed from _posts/2021-04-08-test-post2.md)4
-rw-r--r--_posts/2021-04-08-mathjax.md17
-rw-r--r--_posts/2021-04-08-test-post1.md15
-rw-r--r--_posts/2021-04-09-snippets.md21
-rw-r--r--_posts/2021-04-09-test-post3.md24
-rw-r--r--_posts/2021-04-10-collapsible.md22
-rw-r--r--_posts/snippets/hello.cpp (renamed from _posts/snippets/snippet.cpp)2
-rw-r--r--_posts/snippets/hello.hpp (renamed from _posts/snippets/snippet.hpp)0
-rw-r--r--_posts/snippets/world.cpp7
-rw-r--r--_posts/snippets/world.hpp3
-rw-r--r--index.md6
12 files changed, 93 insertions, 51 deletions
diff --git a/README.md b/README.md
index 9609954..5afec0c 100644
--- a/README.md
+++ b/README.md
@@ -8,9 +8,9 @@ My [Jekyll] theme.
I use it for [egor-tensin.github.io], [blog], [sorting-algorithms].
[Jekyll]: https://jekyllrb.com/
-[egor-tensin.github.io]: https://github.com/egor-tensin/egor-tensin.github.io
-[blog]: https://github.com/egor-tensin/blog/tree/gh-pages
-[sorting-algorithms]: https://github.com/egor-tensin/sorting-algorithms/tree/gh-pages
+[egor-tensin.github.io]: https://egor-tensin.github.io/
+[blog]: https://egor-tensin.github.io/blog/
+[sorting-algorithms]: https://egor-tensin.github.io/sorting-algorithms/
Preview
-------
@@ -93,10 +93,12 @@ Simply including categories/categories.html should do the job.
### Code snippets
-See [Test post 3] for an example of how to conveniently embed snippets in your
-pages.
+See [this post][snippets] for an example of how to conveniently embed code
+snippets in your pages.
Basically, you need to put something like this in the front matter:
+[snippets]: _posts/2021-04-09-snippets.md
+
```
snippets_root_directory: snippets
snippets_language: c++
@@ -109,8 +111,6 @@ snippets:
- world.cpp
```
-[Test post 3]: _posts/2021-04-09-test-post3.md
-
And then you can just format an entire section of snippets using a single
`include`:
@@ -120,6 +120,11 @@ And then you can just format an entire section of snippets using a single
The line above would output both hello.hpp and hello.cpp to the page.
+Code snippets can be hidden in collapsible panels.
+See [this post][collapsible] for an example.
+
+[collapsible]: _posts/2021-04-10-collapsible.md
+
### Typesetting math
[MathJax] can be used to typeset mathematics using LaTeX.
@@ -140,6 +145,10 @@ $$
Behind the scenes, Kramdown transforms these to `\(...\)` and `\[...\]`
sequences, to be processed by MathJax.
+See [this post][mathjax post] for a usage example.
+
+[mathjax post]: _posts/2021-04-08-mathjax.md
+
History
-------
diff --git a/_posts/2021-04-08-test-post2.md b/_posts/2021-04-07-plain.md
index ee0e0a2..362fc89 100644
--- a/_posts/2021-04-08-test-post2.md
+++ b/_posts/2021-04-07-plain.md
@@ -1,7 +1,7 @@
---
-title: Test post 2
+title: Plain text
excerpt: >
- This is test post #2.
+ Just some placeholder text.
category: Life
---
Pellentesque et lacus eget lacus laoreet eleifend eu in nunc.
diff --git a/_posts/2021-04-08-mathjax.md b/_posts/2021-04-08-mathjax.md
new file mode 100644
index 0000000..c521f54
--- /dev/null
+++ b/_posts/2021-04-08-mathjax.md
@@ -0,0 +1,17 @@
+---
+title: MathJax
+excerpt: >
+ Awesome MathJax-powered math!
+category: Work
+mathjax: true
+---
+Today, we'll "prove" that $$2 \times 2 \ne 5$$.
+
+$$
+\begin{gather}
+2 \times 2 = 2 + 2 = 4 \\
+4 \ne 5 \implies 2 \times 2 \ne 5
+\end{gather}
+$$
+
+Q.E.D.
diff --git a/_posts/2021-04-08-test-post1.md b/_posts/2021-04-08-test-post1.md
deleted file mode 100644
index 2ec56a9..0000000
--- a/_posts/2021-04-08-test-post1.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-title: Test post 1
-excerpt: >
- This is test post #1.
-category: Work
----
-Lorem ipsum dolor sit amet, consectetur adipiscing elit.
-Vivamus rutrum cursus lorem, et feugiat arcu porttitor eget.
-Praesent laoreet odio orci.
-Aliquam vel sodales risus, nec auctor elit.
-Interdum et malesuada fames ac ante ipsum primis in faucibus.
-Donec nec pulvinar tellus, id pellentesque arcu.
-Vestibulum id dapibus velit.
-Nam non consequat libero.
-Suspendisse euismod purus vitae luctus molestie.
diff --git a/_posts/2021-04-09-snippets.md b/_posts/2021-04-09-snippets.md
new file mode 100644
index 0000000..f76845a
--- /dev/null
+++ b/_posts/2021-04-09-snippets.md
@@ -0,0 +1,21 @@
+---
+title: Code snippets
+excerpt: >
+ Easily include code snippets in your posts.
+snippets_root_directory: snippets
+snippets_language: c++
+snippets:
+ hello:
+ - hello.hpp
+ - hello.cpp
+ world:
+ - world.hpp
+ - world.cpp
+---
+It's pretty simple, just use the corresponding include:
+
+{% include snippets/section.html section_id='hello' %}
+
+This is another set of snippets:
+
+{% include snippets/section.html section_id='world' %}
diff --git a/_posts/2021-04-09-test-post3.md b/_posts/2021-04-09-test-post3.md
deleted file mode 100644
index a1ca425..0000000
--- a/_posts/2021-04-09-test-post3.md
+++ /dev/null
@@ -1,24 +0,0 @@
----
-title: Test post 3
-excerpt: >
- This is test post #3. With snippets!
-snippets_root_directory: snippets
-snippets_language: c++
-snippets:
- hello:
- - snippet.hpp
- - snippet.cpp
----
-Aenean ex ipsum, feugiat vel tortor sit amet, dictum facilisis dui.
-Pellentesque commodo leo at eros elementum porta.
-Aenean ac mauris risus.
-Nam nec mattis orci.
-Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
-inceptos himenaeos.
-Duis rutrum turpis leo, sit amet cursus tellus tincidunt et.
-Nullam eget tortor nisl.
-Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
-inceptos himenaeos.
-Pellentesque posuere nunc a purus eleifend pulvinar.
-
-{% include snippets/section.html section_id='hello' %}
diff --git a/_posts/2021-04-10-collapsible.md b/_posts/2021-04-10-collapsible.md
new file mode 100644
index 0000000..17b82a3
--- /dev/null
+++ b/_posts/2021-04-10-collapsible.md
@@ -0,0 +1,22 @@
+---
+title: Collapsible snippets
+excerpt: >
+ Snippets can be hidden in collapsible panels.
+snippets_root_directory: snippets
+snippets_language: c++
+snippets_collapsible: true
+snippets:
+ hello:
+ - hello.hpp
+ - hello.cpp
+ world:
+ - world.hpp
+ - world.cpp
+---
+Just set a front matter value, and voilĂ !
+
+{% include snippets/section.html section_id='hello' %}
+
+This is another set of snippets:
+
+{% include snippets/section.html section_id='world' %}
diff --git a/_posts/snippets/snippet.cpp b/_posts/snippets/hello.cpp
index bc4122e..2f96a60 100644
--- a/_posts/snippets/snippet.cpp
+++ b/_posts/snippets/hello.cpp
@@ -1,4 +1,4 @@
-#include "snippet.hpp"
+#include "world.hpp"
#include <iostream>
diff --git a/_posts/snippets/snippet.hpp b/_posts/snippets/hello.hpp
index 46556b6..46556b6 100644
--- a/_posts/snippets/snippet.hpp
+++ b/_posts/snippets/hello.hpp
diff --git a/_posts/snippets/world.cpp b/_posts/snippets/world.cpp
new file mode 100644
index 0000000..54d3807
--- /dev/null
+++ b/_posts/snippets/world.cpp
@@ -0,0 +1,7 @@
+#include "world.hpp"
+
+#include <iostream>
+
+void hello_world() {
+ std::cout << "Hello world!\n";
+}
diff --git a/_posts/snippets/world.hpp b/_posts/snippets/world.hpp
new file mode 100644
index 0000000..32258b1
--- /dev/null
+++ b/_posts/snippets/world.hpp
@@ -0,0 +1,3 @@
+#pragma once
+
+void hello_world();
diff --git a/index.md b/index.md
index 9c8e09d..e1d916e 100644
--- a/index.md
+++ b/index.md
@@ -8,5 +8,7 @@ navbar:
This is a theme preview.
Check out these:
-* [the posts feed]({{ '/feed/' | relative_url }}),
-* [a post with snippets in it]({{ site.baseurl }}{% post_url 2021-04-09-test-post3 %}).
+* [post feed]({{ '/feed/' | relative_url }}),
+* [post with MathJax formulas]({{ site.baseurl }}{% post_url 2021-04-08-mathjax %}),
+* [post with code snippets]({{ site.baseurl }}{% post_url 2021-04-09-snippets %}),
+* [post with collapsible code snippets]({{ site.baseurl }}{% post_url 2021-04-10-collapsible %}).