AsciiDoc Syntax for Note-Taking
Text Formatting
| Syntax | Result |
|---|---|
|
italic |
|
bold |
|
bold italic |
|
|
|
highlighted |
|
H2O (subscript) |
|
E=mc2 (superscript) |
|
struck |
|
underlined |
Admonitions (Callout Boxes)
| General information or supplementary details. |
| Helpful advice or best practices. |
| Critical information you must know. |
| Alerts about potential issues or risks. |
| Actions that may cause data loss or harm. |
|
Block admonition with title
Multi-line content with:
|
Code Blocks with Callouts
let x = 5; (1)
let mut y = 10; (2)
y = y + x; (3)
| 1 | Immutable variable |
| 2 | Mutable variable (note mut) |
| 3 | Can reassign because y is mutable |
Checklists
-
Completed task
-
Also completed
-
Not yet done
-
Watch video
-
Take notes
-
Complete exercise
Keyboard Keys
Press Esc to exit insert mode.
Use Ctrl+C to cancel.
Save with Ctrl+Shift+S.
Navigate:
Click Submit to continue.
Definition Lists
Standard
- Term
-
Definition of the term.
- Another Term
-
Another definition.
Horizontal (side-by-side)
| CPU |
Central Processing Unit |
| RAM |
Random Access Memory |
| SSD |
Solid State Drive |
Q&A Style
-
What is ownership in Rust?
Each value has exactly one owner. When the owner goes out of scope, the value is dropped.
-
What is borrowing?
Temporarily lending a reference to a value without transferring ownership.
Block Types
Example Block
let name = "Evan";
Collapsible Block
Click to expand
Hidden content that expands when clicked.
Useful for solutions, spoilers, or lengthy details.
Lists with Complex Content
Use + to continue list items with blocks:
-
First step:
cargo new myprojectThis creates a new Rust project.
-
Second step:
cd myproject && cargo run
Tables
Basic Table
| Type | Description | Example |
|---|---|---|
i32 |
32-bit signed integer |
|
f64 |
64-bit float |
|
bool |
Boolean |
|
Icons (requires :icons: font)
Completed
Failed
Warning
Idea
Reference
Code example
Hard Line Breaks
Use + at end of line for hard break:
This line appears below.
Or use [%hardbreaks] on a paragraph:
Line one
Line two
Line three
Combining Features (Course Notes Example)
The Three Rules
-
Each value has exactly one owner
-
When owner goes out of scope, value is dropped
-
Ownership can be transferred (moved) or borrowed
|
Think of ownership like a library book:
|
Ownership Example
let s1 = String::from("hello"); (1)
let s2 = s1; (2)
// println!("{}", s1); (3)
println!("{}", s2); (4)
| 1 | s1 owns the String |
| 2 | Ownership moves to s2 |
| 3 | ERROR: s1 no longer valid |
| 4 | OK: s2 is the owner now |
-
Why does Rust have ownership?
To guarantee memory safety at compile time without needing a garbage collector. This makes Rust both safe AND fast.
Quick Reference
NOTE:
|
Info callout |
TIP:
|
Best practice |
[%collapsible]
|
Expandable block |
Term::
|
Definition list |
kbd:[Key]
|
Keyboard shortcut |
icon:name[]
|
Font Awesome icon |
. Item
|
Numbered list |
* [ ]
|
Unchecked checkbox |
* [x]
|
Checked checkbox |
<1>
|
Code callout |
^super^
|
Superscript |
~sub~
|
Subscript |