# Code Blocks
## Indented code block (four spaces)
fn main() {
println!("hello, world");
}
## Backtick fenced code, no language
```
plain fenced code
multiple lines stay verbatim
indentation preserved
```
## Backtick fenced code with language
```rust
use std::collections::HashMap;
fn main() {
let mut m = HashMap::new();
m.insert("k", 42);
println!("{:?}", m);
}
```
## Tilde fenced code (can contain backticks)
~~~javascript
const t = `template ${literal}`;
const re = /\`\$\{[^}]+\}/g;
console.log(t.replace(re, ''));
~~~
## Long fence that contains shorter fences
````
inner ``` triple-backtick stays as text
inner ~~~ tilde fence also stays as text
````
## Code block with info string containing extra words
```python my-script.py executable
def greet(name: str) -> str:
return f"hello, {name}"
```
## Inline code variations
A short `let x = 5;` snippet.
A multi-backtick ``span with ` inside``.
A run of stripped spaces: ` spaces preserved `.
## Code block followed by paragraph
```
end of fenced block
```
This paragraph immediately follows the closing fence to verify spacing.