mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-26 04:42:37 +01:00
Added newer languages where possible
Cannot find existing option for twig/smarty, need to look other methods.
This commit is contained in:
parent
9135a85de4
commit
f51036b203
134
package-lock.json
generated
134
package-lock.json
generated
@ -6,18 +6,8 @@
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@codemirror/commands": "^6.0.1",
|
||||
"@codemirror/lang-cpp": "^6.0.1",
|
||||
"@codemirror/lang-css": "^6.0.0",
|
||||
"@codemirror/lang-html": "^6.1.0",
|
||||
"@codemirror/lang-java": "^6.0.0",
|
||||
"@codemirror/lang-javascript": "^6.0.2",
|
||||
"@codemirror/lang-json": "^6.0.0",
|
||||
"@codemirror/lang-markdown": "^6.0.1",
|
||||
"@codemirror/lang-php": "^6.0.0",
|
||||
"@codemirror/lang-python": "^6.0.1",
|
||||
"@codemirror/lang-rust": "^6.0.0",
|
||||
"@codemirror/lang-sql": "^6.0.0",
|
||||
"@codemirror/lang-xml": "^6.0.0",
|
||||
"@codemirror/language": "^6.2.1",
|
||||
"@codemirror/legacy-modes": "^6.1.0",
|
||||
"@codemirror/state": "^6.1.0",
|
||||
@ -68,15 +58,6 @@
|
||||
"@lezer/common": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-cpp": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-cpp/-/lang-cpp-6.0.2.tgz",
|
||||
"integrity": "sha512-6oYEYUKHvrnacXxWxYa6t4puTlbN3dgV662BDfSH8+MfjQjVmP697/KYTDOqpxgerkvoNm7q5wlFMBeX8ZMocg==",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@lezer/cpp": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-css": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-css/-/lang-css-6.0.2.tgz",
|
||||
@ -104,15 +85,6 @@
|
||||
"@lezer/html": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-java": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-java/-/lang-java-6.0.1.tgz",
|
||||
"integrity": "sha512-OOnmhH67h97jHzCuFaIEspbmsT98fNdhVhmA3zCxW0cn7l8rChDhZtwiwJ/JOKXgfm4J+ELxQihxaI7bj7mJRg==",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@lezer/java": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-javascript": {
|
||||
"version": "6.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-javascript/-/lang-javascript-6.1.4.tgz",
|
||||
@ -127,15 +99,6 @@
|
||||
"@lezer/javascript": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-json": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-json/-/lang-json-6.0.1.tgz",
|
||||
"integrity": "sha512-+T1flHdgpqDDlJZ2Lkil/rLiRy684WMLc74xUnjJH48GQdfJo/pudlTRreZmKwzP8/tGdKf83wlbAdOCzlJOGQ==",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@lezer/json": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-markdown": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-markdown/-/lang-markdown-6.1.0.tgz",
|
||||
@ -161,49 +124,6 @@
|
||||
"@lezer/php": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-python": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-python/-/lang-python-6.1.1.tgz",
|
||||
"integrity": "sha512-AddGMIKUssUAqaDKoxKWA5GAzy/CVE0eSY7/ANgNzdS1GYBkp6N49XKEyMElkuN04UsZ+bTIQdj+tVV75NMwJw==",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.3.2",
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@lezer/python": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-rust": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-rust/-/lang-rust-6.0.1.tgz",
|
||||
"integrity": "sha512-344EMWFBzWArHWdZn/NcgkwMvZIWUR1GEBdwG8FEp++6o6vT6KL9V7vGs2ONsKxxFUPXKI0SPcWhyYyl2zPYxQ==",
|
||||
"dependencies": {
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@lezer/rust": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-sql": {
|
||||
"version": "6.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-sql/-/lang-sql-6.4.0.tgz",
|
||||
"integrity": "sha512-UWGK1+zc9+JtkiT+XxHByp4N6VLgLvC2x0tIudrJG26gyNtn0hWOVoB0A8kh/NABPWkKl3tLWDYf2qOBJS9Zdw==",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.0.0",
|
||||
"@codemirror/language": "^6.0.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/lang-xml": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/lang-xml/-/lang-xml-6.0.2.tgz",
|
||||
"integrity": "sha512-JQYZjHL2LAfpiZI2/qZ/qzDuSqmGKMwyApYmEUUCTxLM4MWS7sATUEfIguZQr9Zjx/7gcdnewb039smF6nC2zw==",
|
||||
"dependencies": {
|
||||
"@codemirror/autocomplete": "^6.0.0",
|
||||
"@codemirror/language": "^6.4.0",
|
||||
"@codemirror/state": "^6.0.0",
|
||||
"@lezer/common": "^1.0.0",
|
||||
"@lezer/xml": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@codemirror/language": {
|
||||
"version": "6.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.6.0.tgz",
|
||||
@ -628,15 +548,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.0.2.tgz",
|
||||
"integrity": "sha512-SVgiGtMnMnW3ActR8SXgsDhw7a0w0ChHSYAyAUxxrOiJ1OqYWEKk/xJd84tTSPo1mo6DXLObAJALNnd0Hrv7Ng=="
|
||||
},
|
||||
"node_modules/@lezer/cpp": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/cpp/-/cpp-1.1.0.tgz",
|
||||
"integrity": "sha512-zUHrjNFuY/DOZCkOBJ6qItQIkcopHM/Zv/QOE0a4XNG3HDNahxTNu5fQYl8dIuKCpxCqRdMl5cEwl5zekFc7BA==",
|
||||
"dependencies": {
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/css": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/css/-/css-1.1.1.tgz",
|
||||
@ -664,15 +575,6 @@
|
||||
"@lezer/lr": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/java": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/java/-/java-1.0.3.tgz",
|
||||
"integrity": "sha512-kKN17wmgP1cgHb8juR4pwVSPMKkDMzY/lAPbBsZ1fpXwbk2sg3N1kIrf0q+LefxgrANaQb/eNO7+m2QPruTFng==",
|
||||
"dependencies": {
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/javascript": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/javascript/-/javascript-1.4.1.tgz",
|
||||
@ -682,15 +584,6 @@
|
||||
"@lezer/lr": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/json": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/json/-/json-1.0.0.tgz",
|
||||
"integrity": "sha512-zbAuUY09RBzCoCA3lJ1+ypKw5WSNvLqGMtasdW6HvVOqZoCpPr8eWrsGnOVWGKGn8Rh21FnrKRVlJXrGAVUqRw==",
|
||||
"dependencies": {
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/lr": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.3.3.tgz",
|
||||
@ -717,33 +610,6 @@
|
||||
"@lezer/lr": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/python": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/python/-/python-1.1.2.tgz",
|
||||
"integrity": "sha512-ukm4VhDasFX7/9BUYHTyUNXH0xQ5B7/QBlZD8P51+dh6GtXRSCQqNxloez5d+MxVb2Sg+31S8E/33qoFREfkpA==",
|
||||
"dependencies": {
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/rust": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/rust/-/rust-1.0.0.tgz",
|
||||
"integrity": "sha512-IpGAxIjNxYmX9ra6GfQTSPegdCAWNeq23WNmrsMMQI7YNSvKtYxO4TX5rgZUmbhEucWn0KTBMeDEPXg99YKtTA==",
|
||||
"dependencies": {
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@lezer/xml": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@lezer/xml/-/xml-1.0.1.tgz",
|
||||
"integrity": "sha512-jMDXrV953sDAUEMI25VNrI9dz94Ai96FfeglytFINhhwQ867HKlCE2jt3AwZTCT7M528WxdDWv/Ty8e9wizwmQ==",
|
||||
"dependencies": {
|
||||
"@lezer/highlight": "^1.0.0",
|
||||
"@lezer/lr": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz",
|
||||
|
10
package.json
10
package.json
@ -24,18 +24,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@codemirror/commands": "^6.0.1",
|
||||
"@codemirror/lang-cpp": "^6.0.1",
|
||||
"@codemirror/lang-css": "^6.0.0",
|
||||
"@codemirror/lang-html": "^6.1.0",
|
||||
"@codemirror/lang-java": "^6.0.0",
|
||||
"@codemirror/lang-javascript": "^6.0.2",
|
||||
"@codemirror/lang-json": "^6.0.0",
|
||||
"@codemirror/lang-markdown": "^6.0.1",
|
||||
"@codemirror/lang-php": "^6.0.0",
|
||||
"@codemirror/lang-python": "^6.0.1",
|
||||
"@codemirror/lang-rust": "^6.0.0",
|
||||
"@codemirror/lang-sql": "^6.0.0",
|
||||
"@codemirror/lang-xml": "^6.0.0",
|
||||
"@codemirror/language": "^6.2.1",
|
||||
"@codemirror/legacy-modes": "^6.1.0",
|
||||
"@codemirror/state": "^6.1.0",
|
||||
|
@ -1,37 +1,37 @@
|
||||
import {StreamLanguage} from "@codemirror/language"
|
||||
|
||||
import {css} from '@codemirror/lang-css';
|
||||
import {c, csharp, kotlin, scala} from '@codemirror/legacy-modes/mode/clike';
|
||||
import {cpp} from '@codemirror/lang-cpp';
|
||||
import {css} from '@codemirror/legacy-modes/mode/css';
|
||||
import {c, cpp, csharp, java, kotlin, scala, dart} from '@codemirror/legacy-modes/mode/clike';
|
||||
import {diff} from '@codemirror/legacy-modes/mode/diff';
|
||||
import {fortran} from '@codemirror/legacy-modes/mode/fortran';
|
||||
import {go} from '@codemirror/legacy-modes/mode/go';
|
||||
import {haskell} from '@codemirror/legacy-modes/mode/haskell';
|
||||
import {html} from '@codemirror/lang-html';
|
||||
import {java} from '@codemirror/lang-java';
|
||||
import {javascript} from '@codemirror/lang-javascript';
|
||||
import {json} from '@codemirror/lang-json';
|
||||
import {javascript, json, typescript} from '@codemirror/legacy-modes/mode/javascript';
|
||||
import {julia} from '@codemirror/legacy-modes/mode/julia';
|
||||
import {lua} from '@codemirror/legacy-modes/mode/lua';
|
||||
import {markdown} from '@codemirror/lang-markdown';
|
||||
import {oCaml, fSharp, sml} from '@codemirror/legacy-modes/mode/mllike';
|
||||
import {nginx} from '@codemirror/legacy-modes/mode/nginx';
|
||||
import {octave} from '@codemirror/legacy-modes/mode/octave';
|
||||
import {perl} from '@codemirror/legacy-modes/mode/perl';
|
||||
import {pascal} from '@codemirror/legacy-modes/mode/pascal';
|
||||
import {php} from '@codemirror/lang-php';
|
||||
import {powerShell} from '@codemirror/legacy-modes/mode/powershell';
|
||||
import {properties} from '@codemirror/legacy-modes/mode/properties';
|
||||
import {python} from '@codemirror/lang-python';
|
||||
import {python} from '@codemirror/legacy-modes/mode/python';
|
||||
import {ruby} from '@codemirror/legacy-modes/mode/ruby';
|
||||
import {rust} from '@codemirror/lang-rust';
|
||||
import {rust} from '@codemirror/legacy-modes/mode/rust';
|
||||
import {scheme} from '@codemirror/legacy-modes/mode/scheme';
|
||||
import {shell} from '@codemirror/legacy-modes/mode/shell';
|
||||
import {sql} from '@codemirror/lang-sql';
|
||||
import {standardSQL, pgSQL, msSQL, mySQL, sqlite, plSQL} from '@codemirror/legacy-modes/mode/sql';
|
||||
import {stex} from '@codemirror/legacy-modes/mode/stex';
|
||||
import {toml} from '@codemirror/legacy-modes/mode/toml';
|
||||
// import {twig, smarty} from '@codemirror/legacy-modes/mode/php'; // TODO
|
||||
import {vb} from '@codemirror/legacy-modes/mode/vb';
|
||||
import {vbScript} from '@codemirror/legacy-modes/mode/vbscript';
|
||||
import {xml} from '@codemirror/lang-xml';
|
||||
import {xml, html} from '@codemirror/legacy-modes/mode/xml';
|
||||
import {yaml} from '@codemirror/legacy-modes/mode/yaml';
|
||||
import {swift} from "@codemirror/legacy-modes/mode/swift";
|
||||
|
||||
|
||||
// Mapping of possible languages or formats from user input to their codemirror modes.
|
||||
@ -40,10 +40,11 @@ import {yaml} from '@codemirror/legacy-modes/mode/yaml';
|
||||
const modeMap = {
|
||||
bash: () => StreamLanguage.define(shell),
|
||||
c: () => StreamLanguage.define(c),
|
||||
css: () => css(),
|
||||
'c++': () => cpp(),
|
||||
css: () => StreamLanguage.define(css),
|
||||
'c++': () => StreamLanguage.define(cpp),
|
||||
'c#': () => StreamLanguage.define(csharp),
|
||||
csharp: () => StreamLanguage.define(csharp),
|
||||
dart: () => StreamLanguage.define(dart),
|
||||
diff: () => StreamLanguage.define(diff),
|
||||
for: () => StreamLanguage.define(fortran),
|
||||
fortran: () => StreamLanguage.define(fortran),
|
||||
@ -52,52 +53,62 @@ const modeMap = {
|
||||
go: () => StreamLanguage.define(go),
|
||||
haskell: () => StreamLanguage.define(haskell),
|
||||
hs: () => StreamLanguage.define(haskell),
|
||||
html: () => html(),
|
||||
html: () => StreamLanguage.define(html),
|
||||
ini: () => StreamLanguage.define(properties),
|
||||
java: () => java(),
|
||||
javascript: () => javascript(),
|
||||
json: () => json(),
|
||||
js: () => javascript(),
|
||||
java: () => StreamLanguage.define(java),
|
||||
javascript: () => StreamLanguage.define(javascript),
|
||||
json: () => StreamLanguage.define(json),
|
||||
js: () => StreamLanguage.define(javascript),
|
||||
jl: () => StreamLanguage.define(julia),
|
||||
julia: () => StreamLanguage.define(julia),
|
||||
kotlin: () => StreamLanguage.define(kotlin),
|
||||
latex: () => StreamLanguage.define(stex),
|
||||
lua: () => StreamLanguage.define(lua),
|
||||
markdown: () => markdown(),
|
||||
matlab: () => StreamLanguage.define(octave),
|
||||
md: () => markdown(),
|
||||
mdown: () => markdown(),
|
||||
ml: () => StreamLanguage.define(sml),
|
||||
mssql: () => StreamLanguage.define(msSQL),
|
||||
mysql: () => StreamLanguage.define(mySQL),
|
||||
nginx: () => StreamLanguage.define(nginx),
|
||||
octave: () => StreamLanguage.define(octave),
|
||||
pas: () => StreamLanguage.define(pascal),
|
||||
pascal: () => StreamLanguage.define(pascal),
|
||||
perl: () => StreamLanguage.define(perl),
|
||||
pgsql: () => StreamLanguage.define(pgSQL),
|
||||
php: (code) => {
|
||||
const hasTags = code.includes('<?php');
|
||||
return php({plain: !hasTags});
|
||||
},
|
||||
pl: () => StreamLanguage.define(perl),
|
||||
'pl/sql': () => StreamLanguage.define(plSQL),
|
||||
postgresql: () => StreamLanguage.define(pgSQL),
|
||||
powershell: () => StreamLanguage.define(powerShell),
|
||||
properties: () => StreamLanguage.define(properties),
|
||||
ocaml: () => StreamLanguage.define(oCaml),
|
||||
py: () => python(),
|
||||
python: () => python(),
|
||||
py: () => StreamLanguage.define(python),
|
||||
python: () => StreamLanguage.define(python),
|
||||
rb: () => StreamLanguage.define(ruby),
|
||||
rs: () => rust(),
|
||||
rs: () => StreamLanguage.define(rust),
|
||||
ruby: () => StreamLanguage.define(ruby),
|
||||
rust: () => rust(),
|
||||
rust: () => StreamLanguage.define(rust),
|
||||
scala: () => StreamLanguage.define(scala),
|
||||
scheme: () => StreamLanguage.define(scheme),
|
||||
shell: () => StreamLanguage.define(shell),
|
||||
sh: () => StreamLanguage.define(shell),
|
||||
stext: () => StreamLanguage.define(stex),
|
||||
swift: () => StreamLanguage.define(swift),
|
||||
toml: () => StreamLanguage.define(toml),
|
||||
ts: () => javascript({typescript: true}),
|
||||
typescript: () => javascript({typescript: true}),
|
||||
sql: () => sql(),
|
||||
ts: () => StreamLanguage.define(typescript),
|
||||
typescript: () => StreamLanguage.define(typescript),
|
||||
sql: () => StreamLanguage.define(standardSQL),
|
||||
sqlite: () => StreamLanguage.define(sqlite),
|
||||
vbs: () => StreamLanguage.define(vbScript),
|
||||
vbscript: () => StreamLanguage.define(vbScript),
|
||||
'vb.net': () => StreamLanguage.define(vb),
|
||||
vbnet: () => StreamLanguage.define(vb),
|
||||
xml: () => xml(),
|
||||
xml: () => StreamLanguage.define(xml),
|
||||
yaml: () => StreamLanguage.define(yaml),
|
||||
yml: () => StreamLanguage.define(yaml),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user