-
Notifications
You must be signed in to change notification settings - Fork 0
/
SyntaxPlugin.tsx
74 lines (69 loc) · 1.6 KB
/
SyntaxPlugin.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import React from 'react';
import SyntaxViewerSettings from '@components/Settings/SyntaxViewerSettings';
import { IPlugin, ViewerType } from './PluginInterface';
// TODO: add more - see https://prismjs.com/#supported-languages
export const Ext2Lang: { [index: string]: string } = {
'c++': 'cpp',
'h++': 'cpp',
bat: 'batch',
c: 'c',
cmake: 'cmake',
cpp: 'cpp',
cs: 'csharp',
css: 'css',
d: 'd',
go: 'go',
h: 'c',
hpp: 'cpp',
html: 'html',
ini: 'ini',
java: 'java',
js: 'javascript',
json: 'json',
jsx: 'jsx',
kt: 'kotlin',
lua: 'lua',
m: 'objectivec',
mm: 'objectivec',
makefile: 'makefile',
md: 'markdown',
pas: 'pascal',
perl: 'perl',
php: 'php',
pl: 'perl',
ps1: 'powershell',
psm1: 'powershell',
py: 'python',
r: 'r',
rb: 'ruby',
rs: 'rust',
sass: 'sass',
scss: 'scss',
sh: 'bash',
scala: 'scala',
sql: 'sql',
svg: 'svg',
swift: 'swift',
tex: 'latex',
ts: 'typescript',
tsx: 'tsx',
txt: 'plain',
xml: 'xml',
yaml: 'yaml',
yml: 'yaml',
};
export class SyntaxPlugin implements IPlugin {
public shortName = 'syntax';
public viewerType = ViewerType.Syntax;
public enabled = true;
public extraExtensions: string[] = [];
public extensions: { [index: string]: boolean } = {};
public customSettings = <SyntaxViewerSettings />;
constructor() {
for (const ext in Ext2Lang) {
if ({}.hasOwnProperty.call(Ext2Lang, ext)) {
this.extensions[ext] = true;
}
}
}
}