···11++++
22+title = "Test Post"
33+date = 2024-10-11
44+slug = "test-post"
55+description = "Testing out styling and features."
66+77+[taxonomies]
88+tags = ["meta"]
99+1010+[extra]
1111+has_toc = true
1212++++
1313+1414+This post is for me to just test out all the features and styling of the blog, and to
1515+make sure that if I change the CSS or anything I don't break any of it! This is also a
1616+sort of light style guide for blog posts in general.
1717+1818+<!-- more -->
1919+2020+First off, this paragraph is after the `<!-- more -->` cutoff, which means that it *should not*
2121+appear in thumbnails linking to this post from elsewhere on the site.
2222+2323+## Section Headers
2424+2525+Sections headers (prefixed with `##` in markdown) are the main content separators for posts, and
2626+can be [linked to](#section-headers) directly. To link to them, the header's text needs to be
2727+*kebab-cased*, so the above would be `#section-headers`.
2828+2929+### But what about sub-headers?
3030+3131+I usually use `###` sub-headers to ask the question I think the reader is (or should be) asking at
3232+this point in the article. For example, if I just posted some code with an obvious error, I might
3333+follow that up with `### Wait, won't that crash?` or something similar. Using this approach lets
3434+me write posts in a conversational way, and helps me continually frame myself in the mind of the
3535+reader.
3636+3737+### Table of Contents
3838+3939+Section and sub-headers can be used to generate a table of contents at the start of the page. To
4040+enable this feature for a post, add the following to the page's frontmatter:
4141+4242+> toml
4343+```toml
4444+[extra]
4545+has_toc = true
4646+```
4747+4848+I don't like content that is nested more than 2 layers deep, so only `##` and `###` should be used
4949+to divide things up.
5050+5151+## Embedding Code
5252+5353+This is prominently a coding blog, so code will show up a lot. First off, a monospaced text block is
5454+denoted by wrapping the text in triple back-tick characters <code>```</code>.
5555+5656+```
5757+┌──────────────────────────┐
5858+│ This text is monospaced. │
5959+│ This │
6060+│ text │
6161+│ is │
6262+│ monospaced. │
6363+└──────────────────────────┘
6464+```
6565+6666+### Syntax Highlighting
6767+6868+If you want syntax coloring, you put the name of the programming language immediately after the ticks.
6969+So writing this:
7070+7171+~~~
7272+```rust
7373+fn main() {
7474+ println!("Hello, world!");
7575+}
7676+```
7777+~~~
7878+7979+Will produce this:
8080+8181+```rust
8282+fn main() {
8383+ println!("Hello, world!");
8484+}
8585+```
8686+8787+### Code Block Title
8888+8989+Sometimes it can help to give a header to a code block to signal what it represents. To do this, you put
9090+a single-line block quote immediately before the code block. So by prepending the following code with
9191+`> src/main.rs`, I can produce this:
9292+9393+> src/main.rs
9494+```rust
9595+fn main() {
9696+ println!("This code is in main.rs!");
9797+}
9898+```
9999+100100+This can be useful to explicitly state the programming language or format being used:
101101+102102+> TOML
103103+```toml
104104+title = "Test Post"
105105+slug = "test-post"
106106+description = "Testing out styling and features."
107107+108108+[taxonomies]
109109+tags = ["meta"]
110110+```
111111+112112+### Inline Code
113113+114114+As seen above, sometimes code items are mentioned in regular paragraphs, but you want to
115115+draw attention to them. To do this, you can wrap it in ` back-tick quotes. For
116116+example, if I wanted to mention Rust's `Vec<T>` type.
117117+118118+```md
119119+`Vec<T>`
120120+```
121121+122122+You can wrap a link around a code tag if you want to link to the docs, for example I could
123123+link to the [`Option<T>::take_if`](https://doc.rust-lang.org/std/option/enum.Option.html#method.take_if)
124124+method directly.
125125+126126+```md
127127+[`Option<T>::take_if`](https://doc.rust-lang.org/std/option/enum.Option.html#method.take_if)
128128+```
129129+130130+## Block Quotes
131131+132132+I can display a quote by prepending multiple lines of text with `>` like so, which will
133133+wrap it in a `blockquote` tag:
134134+135135+> "This text will appear italicized in a quote box!"
136136+137137+### Reader Questions
138138+139139+When displaying reader questions, I start the block quote with a bolded name, like so:
140140+141141+> **SonicFan420x69 asks:**
142142+>
143143+> “What is your opinion of the inimitable video game character, Sonic the Hedgehog? Please
144144+> answer soon as it is a matter of life or death.”
145145+146146+### Cited Quotations
147147+148148+For when I want to have a citation, I can use the html `<cite>` tag after the quote text and it
149149+will prepend it with a nice `—` em dash.
150150+151151+> "I don't know half of you half as well as I should like, and I like less than half of you half
152152+> as well as you deserve."
153153+>
154154+> <cite>Bilbo Baggins</cite>
155155+156156+### Callouts
157157+158158+Sometimes I want to draw the user's attention to a useful piece of information. If I start a
159159+blockquote with an [`<i> icon`](#icons-images), it will style it as a callout. For example,
160160+I could make a little indented to-do list by starting a quote with this:
161161+162162+```html
163163+> <i class="ri-checkbox-multiple-fill"></i> **To Do**
164164+```
165165+166166+Which will produce this:
167167+168168+> <i class="ri-checkbox-multiple-fill"></i> **To Do**
169169+>
170170+> - <i class="ri-checkbox-line"></i> Section Headers
171171+> - <i class="ri-checkbox-line"></i> Syntax Highlighting
172172+> - <i class="ri-checkbox-line"></i> Block Quotes
173173+> - <i class="ri-checkbox-blank-line"></i> Images & Icons
174174+175175+### Warnings
176176+177177+If the icon class is `ri-error-warning-line`, the callout will be colored red:
178178+179179+> <i class="ri-error-warning-line"></i> **Warning!**
180180+>
181181+> Here is something you should be warned about! There's even a big red
182182+> bubble here so you know it's serious. Make sure you don't miss it, or
183183+> the consequences could be dire...
184184+185185+If the icon class is `ri-lightbulb-line`, then the callout will be colored blue.
186186+187187+> <i class="ri-lightbulb-line"></i> **Did you know?**
188188+>
189189+> This isn't a warning, but I wanted to draw your attention to something cool! Did you know
190190+> I take [reader questions](/ask), and will answer them on this blog? Now you know!
191191+192192+These add more colors—and therefore noise—to the page and should be used sparingly.
193193+The warning callout specifically is to alert readers to something particularly important, such
194194+as unsafe code or something they shouldn't do.
195195+196196+## Icons & Images
197197+198198+They were shown in the previous section, but icons (provided by [Remix Icon](https://remixicon.com/)),
199199+can be used anywhere by inserting an `<i>` tag with the icon's class. These are useful for adding
200200+some detail and decorating to the pages, and is another way to break up text.
201201+202202+### Icon Tags
203203+204204+For example, we could check items off a to-do list as the reader progresses in a tutorial:
205205+206206+- <i class="ri-checkbox-line"></i> Wake up
207207+- <i class="ri-checkbox-line"></i> Eat breakfast
208208+- <i class="ri-checkbox-line"></i> Finish this post
209209+- <i class="ri-checkbox-blank-line"></i> ???
210210+- <i class="ri-checkbox-blank-line"></i> Profit!
211211+212212+## Embedding Media
213213+214214+Images and videos are a great way to break up content and prevent text fatigue.
215215+216216+### Images
217217+218218+Images can be embedded using the usual markdown syntax:
219219+220220+```md
221221+
222222+```
223223+224224+
225225+226226+When there are multiple paragraphs of text in a row (usually 3-4), and nothing else to break
227227+them up, images can be interspersed to help prevent text-wall fatique.
228228+229229+You can also add captions to images:
230230+231231+<figure>
232232+ <img src="https://img.itch.zone/aW1hZ2UvNTU2NDU0LzI5MTYzNzkucG5n/original/8LIdCb.png" alt="NOISE1 screenshot">
233233+ <figcaption>
234234+ NOISE1 is a dark sci-fi hacker-typing stealth game.
235235+ </figcaption>
236236+</figure>
237237+238238+But there is no way to do this in markdown so you have to use the `<figure>` tag like so:
239239+240240+```html
241241+<figure>
242242+ <img src="/path/to/image.png" alt="Alt text goes here.">
243243+ <figcaption>Caption text goes here.</figcaption>
244244+</figure>
245245+```
246246+247247+### Videos
248248+249249+To embed a video, you use whatever embed tag works. For example, YouTube provides an `<iframe>` tag for
250250+videos that you can use to embed into the page:
251251+252252+<iframe src="https://www.youtube.com/embed/kiWvNwuBbEE" title="Ikenfell Launch Trailer" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
253253+254254+Do not use a `width` or `height` when doing this. The video should always be the full width of the page,
255255+and the height will be auto-calculated based on a 16:9 aspect ratio.
256256+257257+## Miscellaneous
258258+259259+You can also create `<hr>` horizontal rule tags using `---` in markdown, like so:
260260+261261+---
262262+263263+But these should be used sparingly, if at all.
+6
content/blog/_index.md
···11++++
22+title = "All my writings"
33+sort_by = "date"
44+template = "blog.html"
55+page_template = "blog-page.html"
66++++
+10
templates/blog.html
···11+{% extends "base.html" %} {% block content %}
22+<h1 class="title">{{ section.title }}</h1>
33+<ul>
44+ <!-- If you are using pagination, section.pages will be empty.
55+ You need to use the paginator object -->
66+ {% for page in section.pages %}
77+ <li><a href="{{ page.permalink | safe }}">{{ page.title }}</a></li>
88+ {% endfor %}
99+</ul>
1010+{% endblock content %}