Skip to content

Commit 3295e03

Browse files
committed
fix: detect different shebangs
1 parent e4c609a commit 3295e03

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/highlight/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ const DETECTION_PATTERNS: { language: string; patterns: RegExp[]; weight: number
5252
{
5353
language: 'bash',
5454
patterns: [
55-
/^#!/, // Shebang
55+
/^#!.*\b(?:ba)?sh\b/m, // Bash/sh shebang
56+
/^#!.*\bzsh\b/m, // Zsh shebang
57+
/^#!.*\bfish\b/m, // Fish shebang
5658
/\$\([^)]+\)/, // Command substitution
5759
/\$\{[^}]+\}/, // Variable expansion
5860
/\b(echo|export|source|alias)\b/, // Common builtins
@@ -80,6 +82,9 @@ const DETECTION_PATTERNS: { language: string; patterns: RegExp[]; weight: number
8082
{
8183
language: 'javascript',
8284
patterns: [
85+
/^#!.*\bnode\b/m, // Node.js shebang
86+
/^#!.*\bbun\b/m, // Bun shebang
87+
/^#!.*\bdeno\b/m, // Deno shebang
8388
/\b(const|let|var)\s+\w+\s*=/, // Variable declarations
8489
/\bfunction\s+\w+\s*\(/, // Function declarations
8590
/=>\s*[{(]/, // Arrow functions

0 commit comments

Comments
 (0)