The Node.js® Website
1'use strict';
2
3import diffLanguage from 'shiki/langs/diff.mjs';
4import dockerLanguage from 'shiki/langs/docker.mjs';
5import javaScriptLanguage from 'shiki/langs/javascript.mjs';
6import jsonLanguage from 'shiki/langs/json.mjs';
7import shellScriptLanguage from 'shiki/langs/shellscript.mjs';
8import shellSessionLanguage from 'shiki/langs/shellsession.mjs';
9import typeScriptLanguage from 'shiki/langs/typescript.mjs';
10import shikiNordTheme from 'shiki/themes/nord.mjs';
11
12/** @type {Array<import('shiki').LanguageRegistration>} */
13export const LANGUAGES = [
14 {
15 ...javaScriptLanguage[0],
16 scopeName: 'source.js',
17 aliases: ['mjs', 'cjs', 'js'],
18 displayName: 'JavaScript',
19 },
20 {
21 ...jsonLanguage[0],
22 scopeName: 'source.json',
23 displayName: 'JSON',
24 },
25 {
26 ...typeScriptLanguage[0],
27 scopeName: 'source.ts',
28 aliases: ['ts'],
29 displayName: 'TypeScript',
30 },
31 {
32 ...shellScriptLanguage[0],
33 scopeName: 'source.shell',
34 aliases: ['bash', 'sh', 'shell', 'zsh'],
35 displayName: 'Bash',
36 },
37 {
38 ...shellSessionLanguage[0],
39 scopeName: 'text.shell-session',
40 aliases: ['console'],
41 displayName: 'Bash',
42 },
43 {
44 ...dockerLanguage[0],
45 scopeName: 'source.dockerfile',
46 aliases: ['dockerfile'],
47 displayName: 'Dockerfile',
48 },
49 {
50 ...diffLanguage[0],
51 scopeName: 'source.diff',
52 displayName: 'Diff',
53 },
54];
55
56// This is the default theme we use for our Shiki Syntax Highlighter
57export const DEFAULT_THEME = {
58 // We updating this color because the background color and comment text color
59 // in the Codebox component do not comply with accessibility standards
60 // @see https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html
61 colorReplacements: { '#616e88': '#707e99' },
62 ...shikiNordTheme,
63};