You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.7 KiB
Markdown
76 lines
2.7 KiB
Markdown
![]()
2 years ago
|
+++
|
||
![]()
2 years ago
|
title = "Markdown examples"
|
||
![]()
2 years ago
|
date = 2023-01-31
|
||
![]()
2 years ago
|
updated = 2023-09-01
|
||
![]()
2 years ago
|
description = "This post showcases some examples of Markdown formatting, including a table, code blocks and tags, quotes, tables, and footnotes."
|
||
|
|
||
![]()
2 years ago
|
[taxonomies]
|
||
![]()
2 years ago
|
tags = ["markdown", "showcase"]
|
||
![]()
2 years ago
|
|
||
|
[extra]
|
||
|
katex = true
|
||
![]()
2 years ago
|
footnote_backlinks = true
|
||
![]()
1 year ago
|
social_media_card = "social_cards/blog_markdown.jpg"
|
||
![]()
2 years ago
|
+++
|
||
|
|
||
![]()
2 years ago
|
## $\KaTeX$
|
||
![]()
2 years ago
|
|
||
![]()
2 years ago
|
[$\KaTeX$](https://katex.org/) is a fast and easy-to-use library that enables the rendering of mathematical notation, using LaTeX syntax.
|
||
![]()
2 years ago
|
|
||
![]()
2 years ago
|
You can use $\KaTeX$ **inline** by wrapping the expression between `$` or between `\\(` and `\\)`.
|
||
![]()
2 years ago
|
|
||
|
For example, `$ \sin(x) = \sum_{n=0}^{\infty} \frac{(-1)^n}{(2n + 1)!} x^{2n + 1} $` would render: $ \sin(x) = \sum_{n=0}^{\infty} \frac{(-1)^n}{(2n + 1)!} x^{2n + 1} $
|
||
|
|
||
|
To display the expression **on its own line and centered**, wrap it around `$$` or between `\\[` and `\\]`.
|
||
|
|
||
|
For example, `\\[ r = \frac{\sum_{i=1}^{n}(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum_{i=1}^{n}(x_i - \bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i - \bar{y})^2}} \\]` renders: \\[ r = \frac{\sum_{i=1}^{n}(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum_{i=1}^{n}(x_i - \bar{x})^2}\sqrt{\sum_{i=1}^{n}(y_i - \bar{y})^2}} \\]
|
||
|
|
||
![]()
2 years ago
|
To activate $\KaTeX$ for a post or an entire section, include `katex = true` within the `[extra]` section of the front matter. For exemple:
|
||
![]()
2 years ago
|
|
||
|
```toml,hl_lines=5-6
|
||
|
title = "Testing KaTeX"
|
||
|
date = 2002-11-30
|
||
|
|
||
|
[extra]
|
||
|
katex = true
|
||
|
```
|
||
|
|
||
![]()
2 years ago
|
You may enable it globally as well, by setting `katex = true` in the `[extra]` section of your `config.toml`.
|
||
|
|
||
![]()
2 years ago
|
For enhanced performance and security, the $\KaTeX$ JavaScript, CSS, and fonts are hosted locally.
|
||
![]()
2 years ago
|
|
||
![]()
2 years ago
|
**Note**: After enabling $\KaTeX$, if you want to use \$ without rendering a mathematical expression, escape it with a single backslash: `\$`.
|
||
![]()
2 years ago
|
|
||
![]()
2 years ago
|
## Table
|
||
|
|
||
![]()
2 years ago
|
Here's an example of a table[^1]. Its colours change depending on the current theme.
|
||
![]()
2 years ago
|
|
||
|
| Symbol | Element | Atomic Number |
|
||
|
|---------|---------|---------------|
|
||
|
| H | Hydrogen| 1 |
|
||
|
| C | Carbon | 6 |
|
||
|
| Fe | Iron | 26 |
|
||
|
| Au | Gold | 79 |
|
||
|
|
||
![]()
2 years ago
|
## Code Block
|
||
|
|
||
|
```rust
|
||
|
fn main() {
|
||
![]()
2 years ago
|
println!("Hello, world!") -> ();
|
||
![]()
2 years ago
|
}
|
||
|
```
|
||
![]()
2 years ago
|
|
||
![]()
2 years ago
|
## Code tags
|
||
|
|
||
![]()
2 years ago
|
In Rust, you declare a mutable variable with `let mut x = 5;`, whereas in Python, you simply use `x = 5`. Similarly, to print a value in Rust, you would use `println!("Value: {}", x);`, but in Python, it's as straightforward as `print(f"Value: {x}")`.
|
||
![]()
2 years ago
|
|
||
|
## Quote
|
||
|
|
||
![]()
2 years ago
|
> "We're all hurtling towards death. Yet here we are, for the moment, alive. Each of us knowing we're going to die. Each of us secretly believing we won't."
|
||
![]()
2 years ago
|
>
|
||
|
> — Charlie Kaufman, Synecdoche, New York
|
||
![]()
2 years ago
|
|
||
![]()
2 years ago
|
<hr>
|
||
![]()
2 years ago
|
|
||
|
[^1]: And here's an example of a footnote!
|