Code Snippets
The snippets/ collection is for actual code files, not Markdown.
Creating Snippets
Place code files directly in snippets/:
snippets/
rust/
vec_dedup.rs
error_handling.rs
python/
data_processing.py
bash/
backup_script.sh
Language Detection
Language is detected from file extension:
| Extension | Language |
|---|---|
| .rs | Rust |
| .py | Python |
| .js | JavaScript |
| .ts | TypeScript |
| .go | Go |
| .sh, .bash | Bash |
| .sql | SQL |
| .html | HTML |
| .css | CSS |
Syntax Highlighting
Snippets are syntax-highlighted using the syntect library with the base16-ocean theme.
URL Generation
File paths become slugified URLs:
snippets/rust/vec_dedup.rs → /snippets/vec-dedup/
snippets/bash/my_script.sh → /snippets/my-script/
Subdirectories are organizational only—they don't appear in URLs.
Title Generation
The title comes from the filename:
vec_dedup.rs→ "vec dedup"error-handling.rs→ "error handling"
Snippet Backlinks
Snippets fully participate in backlinks. Link to them from blog posts or notes:
See my [vector deduplication snippet](/snippets/vec-dedup/).
Related: #snippets #code #syntax-highlighting @documentation