The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HighlightHelper.cs 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Teknik.Utilities
  5. {
  6. public static class HighlightHelper
  7. {
  8. public static Dictionary<string, string> Languages
  9. {
  10. get
  11. {
  12. return PrismLanguages; // Set to the currently used syntax list
  13. }
  14. }
  15. public static Dictionary<string, string> PrismLanguages
  16. {
  17. get
  18. {
  19. return new Dictionary<string, string>()
  20. {
  21. { "markup", "Markup" },
  22. { "css", "CSS" },
  23. { "clike", "C-like" },
  24. { "javascript", "JavaScript" },
  25. { "abap", "ABAP" },
  26. { "actionscript", "ActionScript" },
  27. { "ada", "Ada" },
  28. { "apacheconf", "Apache Configuration" },
  29. { "apl", "APL" },
  30. { "applescript", "AppleScript" },
  31. { "arduino", "Arduino" },
  32. { "arff", "ARFF" },
  33. { "asciidoc", "AsciiDoc" },
  34. { "asm6502", "6502 Assembly" },
  35. { "aspnet", "ASP.NET (C#)" },
  36. { "autohotkey", "AutoHotkey" },
  37. { "autoit", "AutoIt" },
  38. { "bash", "Bash" },
  39. { "basic", "BASIC" },
  40. { "batch", "Batch" },
  41. { "bison", "Bison" },
  42. { "brainfuck", "Brainfuck" },
  43. { "bro", "Bro" },
  44. { "c", "C" },
  45. { "csharp", "C#" },
  46. { "cpp", "C++" },
  47. { "coffeescript", "CoffeeScript" },
  48. { "clojure", "Clojure" },
  49. { "crystal", "Crystal" },
  50. { "csp", "Content-Security-Policy" },
  51. { "css-extras", "CSS Extras" },
  52. { "d", "D" },
  53. { "dart", "Dart" },
  54. { "diff", "Diff" },
  55. { "django", "Django/Jinja2" },
  56. { "docker", "Docker" },
  57. { "eiffel", "Eiffel" },
  58. { "elixir", "Elixir" },
  59. { "elm", "Elm" },
  60. { "erb", "ERB" },
  61. { "erlang", "Erlang" },
  62. { "fsharp", "F#" },
  63. { "flow", "Flow" },
  64. { "fortran", "Fortran" },
  65. { "gedcom", "GEDCOM" },
  66. { "gherkin", "Gherkin" },
  67. { "git", "Git" },
  68. { "glsl", "GLSL" },
  69. { "go", "Go" },
  70. { "graphql", "GraphQL" },
  71. { "groovy", "Groovy" },
  72. { "haml", "Haml" },
  73. { "handlebars", "Handlebars" },
  74. { "haskell", "Haskell" },
  75. { "haxe", "Haxe" },
  76. { "http", "HTTP" },
  77. { "hpkp", "HTTP Public-Key-Pins" },
  78. { "hsts", "HTTP Strict-Transport-Security" },
  79. { "ichigojam", "IchigoJam" },
  80. { "icon", "Icon" },
  81. { "inform7", "Inform 7" },
  82. { "ini", "Ini" },
  83. { "io", "Io" },
  84. { "j", "J" },
  85. { "java", "Java" },
  86. { "jolie", "Jolie" },
  87. { "json", "JSON" },
  88. { "julia", "Julia" },
  89. { "keyman", "Keyman" },
  90. { "kotlin", "Kotlin" },
  91. { "latex", "LaTeX" },
  92. { "less", "Less" },
  93. { "liquid", "Liquid" },
  94. { "lisp", "Lisp" },
  95. { "livescript", "LiveScript" },
  96. { "lolcode", "LOLCODE" },
  97. { "lua", "Lua" },
  98. { "makefile", "Makefile" },
  99. { "markdown", "Markdown" },
  100. { "markup-templating", "Markup templating" },
  101. { "matlab", "MATLAB" },
  102. { "mel", "MEL" },
  103. { "mizar", "Mizar" },
  104. { "monkey", "Monkey" },
  105. { "n4js", "N4JS" },
  106. { "nasm", "NASM" },
  107. { "nginx", "nginx" },
  108. { "nim", "Nim" },
  109. { "nix", "Nix" },
  110. { "nsis", "NSIS" },
  111. { "objectivec", "Objective-C" },
  112. { "ocaml", "OCaml" },
  113. { "opencl", "OpenCL" },
  114. { "oz", "Oz" },
  115. { "parigp", "PARI/GP" },
  116. { "parser", "Parser" },
  117. { "pascal", "Pascal" },
  118. { "perl", "Perl" },
  119. { "php", "PHP" },
  120. { "php-extras", "PHP Extras" },
  121. { "plsql", "PL/SQL" },
  122. { "powershell", "PowerShell" },
  123. { "processing", "Processing" },
  124. { "prolog", "Prolog" },
  125. { "properties", ".properties" },
  126. { "protobuf", "Protocol Buffers" },
  127. { "pug", "Pug" },
  128. { "puppet", "Puppet" },
  129. { "pure", "Pure" },
  130. { "python", "Python" },
  131. { "q", "Q (kdb+ database)" },
  132. { "qore", "Qore" },
  133. { "r", "R" },
  134. { "jsx", "React JSX" },
  135. { "tsx", "React TSX" },
  136. { "renpy", "Ren'py" },
  137. { "reason", "Reason" },
  138. { "rest", "reST (reStructuredText)" },
  139. { "rip", "Rip" },
  140. { "roboconf", "Roboconf" },
  141. { "ruby", "Ruby" },
  142. { "rust", "Rust" },
  143. { "sas", "SAS" },
  144. { "sass", "Sass (Sass)" },
  145. { "scss", "Sass (Scss)" },
  146. { "scala", "Scala" },
  147. { "scheme", "Scheme" },
  148. { "smalltalk", "Smalltalk" },
  149. { "smarty", "Smarty" },
  150. { "sql", "SQL" },
  151. { "soy", "Soy (Closure Template)" },
  152. { "stylus", "Stylus" },
  153. { "swift", "Swift" },
  154. { "tap", "TAP" },
  155. { "tcl", "Tcl" },
  156. { "textile", "Textile" },
  157. { "tt2", "Template Toolkit 2" },
  158. { "twig", "Twig" },
  159. { "typescript", "TypeScript" },
  160. { "vbnet", "VB.Net" },
  161. { "velocity", "Velocity" },
  162. { "verilog", "Verilog" },
  163. { "vhdl", "VHDL" },
  164. { "vim", "vim" },
  165. { "visual-basic", "Visual Basic" },
  166. { "wasm", "WebAssembly" },
  167. { "wiki", "Wiki markup" },
  168. { "xeora", "Xeora" },
  169. { "xojo", "Xojo (REALbasic)" },
  170. { "xquery", "XQuery" },
  171. { "yaml", "YAML" }
  172. };
  173. }
  174. }
  175. public static Dictionary<string, string> HighlightLanguages
  176. {
  177. get
  178. {
  179. return new Dictionary<string, string>()
  180. {
  181. { "1c", "1C" },
  182. { "abnf", "ABNF" },
  183. { "accesslog", "Access logs" },
  184. { "ada", "Ada" },
  185. { "armasm", "ARM assembler" },
  186. { "arm", "ARM assembler" },
  187. { "avrasm", "AVR assembler" },
  188. { "actionscript", "ActionScript" },
  189. { "as", "ActionScript" },
  190. { "apache", "Apache" },
  191. { "apacheconf", "Apache" },
  192. { "applescript", "AppleScript" },
  193. { "osascript", "AppleScript" },
  194. { "asciidoc", "AsciiDoc" },
  195. { "adoc", "AsciiDoc" },
  196. { "aspectj", "AspectJ" },
  197. { "autohotkey", "AutoHotkey" },
  198. { "autoit", "AutoIt" },
  199. { "awk", "Awk" },
  200. { "mawk", "Awk" },
  201. { "nawk", "Awk" },
  202. { "gawk", "Awk" },
  203. { "axapta", "Axapta" },
  204. { "bash", "Bash" },
  205. { "sh", "Bash" },
  206. { "zsh", "Bash" },
  207. { "basic", "Basic" },
  208. { "bnf", "BNF" },
  209. { "brainfuck", "Brainfuck" },
  210. { "bf", "Brainfuck" },
  211. { "cs", "C#" },
  212. { "csharp", "C#" },
  213. { "cpp", "C++" },
  214. { "c", "C" },
  215. { "cc", "C++" },
  216. { "h", "C++" },
  217. { "c++", "C++" },
  218. { "h++", "C++" },
  219. { "hpp", "C++" },
  220. { "cal", "C/AL" },
  221. { "cos", "Cache Object Script" },
  222. { "cls", "Cache Object Script" },
  223. { "cmake", "CMake" },
  224. { "cmake.in", "CMake" },
  225. { "coq", "Coq" },
  226. { "csp", "CSP" },
  227. { "css", "CSS" },
  228. { "capnproto", "Cap’n Proto" },
  229. { "capnp", "Cap’n Proto" },
  230. { "clojure", "Clojure" },
  231. { "clj", "Clojure" },
  232. { "coffeescript", "CoffeeScript" },
  233. { "coffee", "CoffeeScript" },
  234. { "cson", "CoffeeScript" },
  235. { "iced", "CoffeeScript" },
  236. { "crmsh", "Crmsh" },
  237. { "crm", "Crmsh" },
  238. { "pcmk", "Crmsh" },
  239. { "crystal", "Crystal" },
  240. { "cr", "Crystal" },
  241. { "d", "D" },
  242. { "dns", "DNS Zone file" },
  243. { "zone", "DNS Zone file" },
  244. { "bind", "DNS Zone file" },
  245. { "dos", "DOS" },
  246. { "bat", "DOS" },
  247. { "cmd", "DOS" },
  248. { "dart", "Dart" },
  249. { "delphi", "Delphi" },
  250. { "dpr", "Delphi" },
  251. { "dfm", "Delphi" },
  252. { "pas", "Delphi" },
  253. { "pascal", "Delphi" },
  254. { "freepascal", "Delphi" },
  255. { "lazarus", "Delphi" },
  256. { "lpr", "Delphi" },
  257. { "lfm", "Delphi" },
  258. { "diff", "Diff" },
  259. { "patch", "Diff" },
  260. { "django", "Django" },
  261. { "jinja", "Django" },
  262. { "dockerfile", "Dockerfile" },
  263. { "docker", "Dockerfile" },
  264. { "dsconfig", "dsconfig" },
  265. { "dts", "DTS (Device Tree)" },
  266. { "dust", "Dust" },
  267. { "dst", "Dust" },
  268. { "ebnf", "EBNF" },
  269. { "elixir", "Elixir" },
  270. { "elm", "Elm" },
  271. { "erlang", "Erlang" },
  272. { "erl", "Erlang" },
  273. { "excel", "Excel" },
  274. { "xls", "Excel" },
  275. { "xlsx", "Excel" },
  276. { "fsharp", "F#" },
  277. { "fs", "F#" },
  278. { "fix", "FIX" },
  279. { "fortran", "Fortran" },
  280. { "f90", "Fortran" },
  281. { "f95", "Fortran" },
  282. { "gcode", "G-Code" },
  283. { "nc", "G-Code" },
  284. { "gams", "Gams" },
  285. { "gms", "Gams" },
  286. { "gauss", "GAUSS" },
  287. { "gss", "GAUSS" },
  288. { "gherkin", "Gherkin" },
  289. { "go", "Go" },
  290. { "golang", "Go" },
  291. { "golo", "Golo" },
  292. { "gololang", "Golo" },
  293. { "gradle", "Gradle" },
  294. { "groovy", "Groovy" },
  295. { "xml", "XML" },
  296. { "html", "HTML" },
  297. { "xhtml", "XHTML" },
  298. { "rss", "RSS" },
  299. { "atom", "Atom" },
  300. { "xjb", "HTML, XML" },
  301. { "xsd", "HTML, XML" },
  302. { "xsl", "HTML, XML" },
  303. { "plist", "HTML, XML" },
  304. { "http", "HTTP" },
  305. { "https", "HTTP" },
  306. { "haml", "Haml" },
  307. { "handlebars", "Handlebars" },
  308. { "hbs", "Handlebars" },
  309. { "html.hbs", "Handlebars" },
  310. { "html.handlebars", "Handlebars" },
  311. { "haskell", "Haskell" },
  312. { "hs", "Haskell" },
  313. { "haxe", "Haxe" },
  314. { "hx", "Haxe" },
  315. { "hy", "Hy" },
  316. { "hylang", "Hy" },
  317. { "ini", "Ini" },
  318. { "inform7", "Inform7" },
  319. { "i7", "Inform7" },
  320. { "irpf90", "IRPF90" },
  321. { "json", "JSON" },
  322. { "java", "Java" },
  323. { "jsp", "Java" },
  324. { "javascript", "JavaScript" },
  325. { "js", "JavaScript" },
  326. { "jsx", "JavaScript" },
  327. { "leaf", "Leaf" },
  328. { "lasso", "Lasso" },
  329. { "lassoscript", "Lasso" },
  330. { "less", "Less" },
  331. { "ldif", "LDIF" },
  332. { "lisp", "Lisp" },
  333. { "livecodeserver", "LiveCode Server" },
  334. { "livescript", "LiveScript" },
  335. { "ls", "LiveScript" },
  336. { "lua", "Lua" },
  337. { "makefile", "Makefile" },
  338. { "mk", "Makefile" },
  339. { "mak", "Makefile" },
  340. { "markdown", "Markdown" },
  341. { "md", "Markdown" },
  342. { "mkdown", "Markdown" },
  343. { "mkd", "Markdown" },
  344. { "mathematica", "Mathematica" },
  345. { "mma", "Mathematica" },
  346. { "matlab", "Matlab" },
  347. { "maxima", "Maxima" },
  348. { "mel", "Maya Embedded Language" },
  349. { "mercury", "Mercury" },
  350. { "mizar", "Mizar" },
  351. { "mojolicious", "Mojolicious" },
  352. { "monkey", "Monkey" },
  353. { "moonscript", "Moonscript" },
  354. { "moon", "Moonscript" },
  355. { "n1ql", "N1QL" },
  356. { "nsis", "NSIS" },
  357. { "nginx", "Nginx" },
  358. { "nginxconf", "Nginx" },
  359. { "nimrod", "Nimrod" },
  360. { "nim", "Nimrod" },
  361. { "nix", "Nix" },
  362. { "ocaml", "OCaml" },
  363. { "ml", "OCaml" },
  364. { "objectivec", "Objective C" },
  365. { "mm", "Objective C" },
  366. { "objc", "Objective C" },
  367. { "obj-c", "Objective C" },
  368. { "glsl", "OpenGL Shading Language" },
  369. { "openscad", "OpenSCAD" },
  370. { "scad", "OpenSCAD" },
  371. { "ruleslanguage", "Oracle Rules Language" },
  372. { "oxygene", "Oxygene" },
  373. { "pf", "PF" },
  374. { "pf.conf", "PF" },
  375. { "php", "PHP" },
  376. { "php3", "PHP" },
  377. { "php4", "PHP" },
  378. { "php5", "PHP" },
  379. { "php6", "PHP" },
  380. { "parser3", "Parser3" },
  381. { "perl", "Perl" },
  382. { "pl", "Perl" },
  383. { "pm", "Perl" },
  384. { "pony", "Pony" },
  385. { "powershell", "PowerShell" },
  386. { "ps", "PowerShell" },
  387. { "processing", "Processing" },
  388. { "prolog", "Prolog" },
  389. { "protobuf", "Protocol Buffers" },
  390. { "puppet", "Puppet" },
  391. { "pp", "Puppet" },
  392. { "python", "Python" },
  393. { "py", "Python" },
  394. { "gyp", "Python" },
  395. { "profile", "Python profiler results" },
  396. { "k", "Q" },
  397. { "kdb", "Q" },
  398. { "qml", "QML" },
  399. { "r", "R" },
  400. { "rib", "RenderMan RIB" },
  401. { "rsl", "RenderMan RSL" },
  402. { "graph", "Roboconf" },
  403. { "instances", "Roboconf" },
  404. { "ruby", "Ruby" },
  405. { "rb", "Ruby" },
  406. { "gemspec", "Ruby" },
  407. { "podspec", "Ruby" },
  408. { "thor", "Ruby" },
  409. { "irb", "Ruby" },
  410. { "rust", "Rust" },
  411. { "rs", "Rust" },
  412. { "scss", "SCSS" },
  413. { "sql", "SQL" },
  414. { "p21", "STEP Part 21" },
  415. { "step", "STEP Part 21" },
  416. { "stp", "STEP Part 21" },
  417. { "scala", "Scala" },
  418. { "scheme", "Scheme" },
  419. { "scilab", "Scilab" },
  420. { "sci", "Scilab" },
  421. { "shell", "Shell" },
  422. { "console", "Shell" },
  423. { "smali", "Smali" },
  424. { "smalltalk", "Smalltalk" },
  425. { "st", "Smalltalk" },
  426. { "stan", "Stan" },
  427. { "stata", "Stata" },
  428. { "stylus", "Stylus" },
  429. { "styl", "Stylus" },
  430. { "subunit", "SubUnit" },
  431. { "swift", "Swift" },
  432. { "tap", "Test Anything Protocol" },
  433. { "tcl", "Tcl" },
  434. { "tk", "Tcl" },
  435. { "tex", "TeX" },
  436. { "thrift", "Thrift" },
  437. { "tp", "TP" },
  438. { "twig", "Twig" },
  439. { "craftcms", "Twig" },
  440. { "typescript", "TypeScript" },
  441. { "ts", "TypeScript" },
  442. { "vbnet", "VB.Net" },
  443. { "vb", "VB.Net" },
  444. { "vbscript", "VBScript" },
  445. { "vbs", "VBScript" },
  446. { "vhdl", "VHDL" },
  447. { "vala", "Vala" },
  448. { "verilog", "Verilog" },
  449. { "v", "Verilog" },
  450. { "vim", "Vim Script" },
  451. { "x86asm", "x86 Assembly" },
  452. { "xl", "XL" },
  453. { "tao", "XL" },
  454. { "xpath", "XQuery" },
  455. { "xq", "XQuery" },
  456. { "zephir", "Zephir" },
  457. { "zep", "Zephir" }
  458. };
  459. }
  460. }
  461. }
  462. }