Skip to content

Commit

Permalink
feat: Add PowerShell support to Shiki (nodejs#6538)
Browse files Browse the repository at this point in the history
* feat: Add PowerShell support to Shiki

* chore: Keep syntax highligh as Bash for windows only change name
  • Loading branch information
thisalihassan authored Mar 26, 2024
1 parent 14acab3 commit e6f05f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/Downloads/Release/ReleaseCodeBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ const ReleaseCodeBox: FC = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [release.versionWithPrefix, os, platform]);

const codeLanguage = os === 'WIN' ? 'PowerShell' : 'Bash';
return (
<div className="mb-2 mt-6 flex min-h-80 flex-col gap-2">
{code && (
<CodeBox language="Bash">
<CodeBox language={codeLanguage}>
<code dangerouslySetInnerHTML={{ __html: code }} />
</CodeBox>
)}
Expand Down
7 changes: 7 additions & 0 deletions shiki.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import diffLanguage from 'shiki/langs/diff.mjs';
import dockerLanguage from 'shiki/langs/docker.mjs';
import javaScriptLanguage from 'shiki/langs/javascript.mjs';
import jsonLanguage from 'shiki/langs/json.mjs';
import powershellLanguage from 'shiki/langs/powershell.mjs';
import shellScriptLanguage from 'shiki/langs/shellscript.mjs';
import shellSessionLanguage from 'shiki/langs/shellsession.mjs';
import typeScriptLanguage from 'shiki/langs/typescript.mjs';
Expand Down Expand Up @@ -34,6 +35,12 @@ export const LANGUAGES = [
aliases: ['bash', 'sh', 'shell', 'zsh'],
displayName: 'Bash',
},
{
...powershellLanguage[0],
scopeName: 'source.powershell',
aliases: ['ps', 'ps1'],
displayName: 'PowerShell',
},
{
...shellSessionLanguage[0],
scopeName: 'text.shell-session',
Expand Down

0 comments on commit e6f05f2

Please sign in to comment.