mirror of
https://github.com/SunRed/haste-server.git
synced 2024-11-23 17:50:19 +01:00
Updated highlightjs to support many more languages (#6)
We updated highlight.min.js library to newer version (v9.12.0 -> 10.2.0) and added support for many languages. Updated extensionMap accordingly and also removed from it some unnecessary aliases, like 'json' since they are already natively supported by highlight.min.js library. There also a new documentation page under docs/languages.md which lists all supported aliases.
This commit is contained in:
parent
3d501c980f
commit
f8c3a58b3a
3 changed files with 70 additions and 11 deletions
59
docs/languages.md
Normal file
59
docs/languages.md
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
# Supported Languages
|
||||||
|
Haste-server supports all 38 "common" languages according to [highlight.js](https://highlightjs.org/), the syntax library used for this project.
|
||||||
|
Any extra languages originally put into this project have remained as well for a total of 47 languages.
|
||||||
|
|
||||||
|
Below is a table of every supported language and it's shorthand if it has one. The shorthand can be used as a file extension.
|
||||||
|
(For example https://haste.zneix.eu/ovanazeyad.rust could be re-written as https://haste.zneix.eu/ovanazeyad.rs).
|
||||||
|
It is also perfectly valid to just use the name of the language (https://haste.zneix.eu/sadf.haskell)
|
||||||
|
|
||||||
|
If the library guesses the language wrong you can replace the file extension with the correct language to force highlighting for that language
|
||||||
|
|
||||||
|
| Language | Extension |
|
||||||
|
|----------|-----------|
|
||||||
|
| Apache Config | apache
|
||||||
|
| Bash | sh
|
||||||
|
| C | c
|
||||||
|
| C-like foundation grammar<br>for C/C++ grammars | clike
|
||||||
|
| CoffeeScript | coffee
|
||||||
|
| C++ | cpp
|
||||||
|
| C# | cs
|
||||||
|
| CSS | css
|
||||||
|
| Delphi | dpr
|
||||||
|
| Diff | diff
|
||||||
|
| Erlang | erl
|
||||||
|
| Go | go
|
||||||
|
| Haskell | hs
|
||||||
|
| HTTP | http
|
||||||
|
| TOML/INI | ini
|
||||||
|
| Java | java
|
||||||
|
| JavaScript | js
|
||||||
|
| JSON | json
|
||||||
|
| Kotlin | kt
|
||||||
|
| LaTeX | tex
|
||||||
|
| Less | less
|
||||||
|
| Lisp | lsp
|
||||||
|
| Lua | lua
|
||||||
|
| Makefile | mk
|
||||||
|
| Markdown | md
|
||||||
|
| Nginx config | nginx
|
||||||
|
| Objective-C | mm
|
||||||
|
| Perl | pl
|
||||||
|
| PHP | php
|
||||||
|
| PHP Template | phptemp
|
||||||
|
| Plain text | txt
|
||||||
|
| .properties | properties
|
||||||
|
| Python | py
|
||||||
|
| Python REPL | pyrepl
|
||||||
|
| Ruby | rb
|
||||||
|
| Rust | rs
|
||||||
|
| Scala | sc
|
||||||
|
| SCSS | scss
|
||||||
|
| Shell Session | shell
|
||||||
|
| Smalltalk | sm
|
||||||
|
| SQL | sql
|
||||||
|
| Swift | swift
|
||||||
|
| TypeScript | ts
|
||||||
|
| Vala | vala
|
||||||
|
| VBScript | vbs
|
||||||
|
| XML | xml
|
||||||
|
| YAML | yaml
|
|
@ -333,13 +333,11 @@ class haste {
|
||||||
// due to the behavior of lookupTypeByExtension and lookupExtensionByType
|
// due to the behavior of lookupTypeByExtension and lookupExtensionByType
|
||||||
// Note: optimized for lookupTypeByExtension
|
// Note: optimized for lookupTypeByExtension
|
||||||
haste.extensionMap = {
|
haste.extensionMap = {
|
||||||
rb: 'ruby', py: 'python', pl: 'perl', php: 'php', scala: 'scala', go: 'go',
|
sh: 'bash', clike: 'c-like', coffee: 'coffeescript', cs: 'csharp', dpr: 'delphi',
|
||||||
xml: 'xml', html: 'xml', htm: 'xml', css: 'css', js: 'javascript', vbs: 'vbscript',
|
erl: 'erlang', hs: 'haskell', js: 'javascript', kt: 'kotlin', tex: 'latex',
|
||||||
lua: 'lua', pas: 'delphi', java: 'java', cpp: 'cpp', cc: 'cpp', m: 'objectivec',
|
lsp: 'lisp', mk: 'makefile', md: 'markdown', mm: 'objectivec', phptemp: 'php-template',
|
||||||
vala: 'vala', sql: 'sql', sm: 'smalltalk', lisp: 'lisp', ini: 'ini',
|
pl: 'perl', txt: 'plaintext', py: 'python', pyrepl: 'python-repl', rb: 'ruby', rs: 'rust',
|
||||||
diff: 'diff', bash: 'bash', sh: 'bash', tex: 'tex', erl: 'erlang', hs: 'haskell',
|
sc: 'scala', sm: 'smalltalk', ts: 'typscript', vbs: 'vbscript', html: 'xml', htm: 'xml',
|
||||||
md: 'markdown', txt: '', coffee: 'coffee', json: 'javascript',
|
|
||||||
swift: 'swift'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,7 +349,6 @@ haste.extensionMap = {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///// Tab behavior in the textarea - 2 spaces per tab
|
///// Tab behavior in the textarea - 2 spaces per tab
|
||||||
$(function(){
|
$(function(){
|
||||||
$('textarea').keydown(function(evt){
|
$('textarea').keydown(function(evt){
|
||||||
|
|
9
static/highlight.min.js
vendored
9
static/highlight.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue