Skip to content

Commit e6f05f2

Browse files
feat: Add PowerShell support to Shiki (#6538)
* feat: Add PowerShell support to Shiki * chore: Keep syntax highligh as Bash for windows only change name
1 parent 14acab3 commit e6f05f2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

components/Downloads/Release/ReleaseCodeBox.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ const ReleaseCodeBox: FC = () => {
3232
// eslint-disable-next-line react-hooks/exhaustive-deps
3333
}, [release.versionWithPrefix, os, platform]);
3434

35+
const codeLanguage = os === 'WIN' ? 'PowerShell' : 'Bash';
3536
return (
3637
<div className="mb-2 mt-6 flex min-h-80 flex-col gap-2">
3738
{code && (
38-
<CodeBox language="Bash">
39+
<CodeBox language={codeLanguage}>
3940
<code dangerouslySetInnerHTML={{ __html: code }} />
4041
</CodeBox>
4142
)}

shiki.config.mjs

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import diffLanguage from 'shiki/langs/diff.mjs';
44
import dockerLanguage from 'shiki/langs/docker.mjs';
55
import javaScriptLanguage from 'shiki/langs/javascript.mjs';
66
import jsonLanguage from 'shiki/langs/json.mjs';
7+
import powershellLanguage from 'shiki/langs/powershell.mjs';
78
import shellScriptLanguage from 'shiki/langs/shellscript.mjs';
89
import shellSessionLanguage from 'shiki/langs/shellsession.mjs';
910
import typeScriptLanguage from 'shiki/langs/typescript.mjs';
@@ -34,6 +35,12 @@ export const LANGUAGES = [
3435
aliases: ['bash', 'sh', 'shell', 'zsh'],
3536
displayName: 'Bash',
3637
},
38+
{
39+
...powershellLanguage[0],
40+
scopeName: 'source.powershell',
41+
aliases: ['ps', 'ps1'],
42+
displayName: 'PowerShell',
43+
},
3744
{
3845
...shellSessionLanguage[0],
3946
scopeName: 'text.shell-session',

0 commit comments

Comments
 (0)