bim

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:

ExtensionLanguage
.rsRust
.pyPython
.jsJavaScript
.tsTypeScript
.goGo
.sh, .bashBash
.sqlSQL
.htmlHTML
.cssCSS

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:

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