A vibe coded tangled fork which supports pijul.

appview/pages: detect syntax highlighting from shebang

Fall back to parsing the shebang line for extensionless scripts,
enabling highlighting for files like nushell/python/bash scripts
that lack a file extension.

Signed-off-by: Niclas Overby <niclas@overby.me>

authored by

Niclas Overby and committed by tangled.org 77981e7b 5b627fe9

+13
+13
appview/pages/funcmap.go
··· 295 295 296 296 lexer := lexers.Get(filepath.Base(path)) 297 297 if lexer == nil { 298 + if firstLine, _, ok := strings.Cut(content, "\n"); ok && strings.HasPrefix(firstLine, "#!") { 299 + // extract interpreter from shebang (handles "#!/usr/bin/env nu", "#!/usr/bin/nu", etc.) 300 + fields := strings.Fields(firstLine[2:]) 301 + if len(fields) > 0 { 302 + interp := filepath.Base(fields[len(fields)-1]) 303 + lexer = lexers.Get(interp) 304 + } 305 + } 306 + } 307 + if lexer == nil { 308 + lexer = lexers.Analyse(content) 309 + } 310 + if lexer == nil { 298 311 lexer = lexers.Fallback 299 312 } 300 313