From d5056423364188f5b5862334e63f976834065360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20H=C3=B6rmann?= Date: Tue, 29 Nov 2022 14:53:41 +0100 Subject: [PATCH] Add popular PHP templating languages to code editor Smarty and Twig are two very popular PHP templating engines and might be useful to some Bookstack users too. --- resources/js/code.mjs | 4 ++++ resources/views/pages/parts/code-editor.blade.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/resources/js/code.mjs b/resources/js/code.mjs index ad282f2be..8d8062689 100644 --- a/resources/js/code.mjs +++ b/resources/js/code.mjs @@ -26,10 +26,12 @@ import 'codemirror/mode/python/python'; import 'codemirror/mode/ruby/ruby'; import 'codemirror/mode/rust/rust'; import 'codemirror/mode/shell/shell'; +import 'codemirror/mode/smarty/smarty'; import 'codemirror/mode/sql/sql'; import 'codemirror/mode/stex/stex'; import 'codemirror/mode/swift/swift'; import 'codemirror/mode/toml/toml'; +import 'codemirror/mode/twig/twig'; import 'codemirror/mode/vb/vb'; import 'codemirror/mode/vbscript/vbscript'; import 'codemirror/mode/xml/xml'; @@ -94,11 +96,13 @@ const modeMap = { rs: 'rust', shell: 'shell', sh: 'shell', + smarty: 'smarty', sql: 'text/x-sql', stext: 'text/x-stex', swift: 'text/x-swift', toml: 'toml', ts: 'text/typescript', + twig: 'twig', typescript: 'text/typescript', vbs: 'vbscript', vbscript: 'vbscript', diff --git a/resources/views/pages/parts/code-editor.blade.php b/resources/views/pages/parts/code-editor.blade.php index 18c9ad423..212f2e5e7 100644 --- a/resources/views/pages/parts/code-editor.blade.php +++ b/resources/views/pages/parts/code-editor.blade.php @@ -25,8 +25,8 @@ $languages = [ 'Bash', 'CSS', 'C', 'C++', 'C#', 'Dart', 'Diff', 'Fortran', 'F#', 'Go', 'Haskell', 'HTML', 'INI', 'Java', 'JavaScript', 'JSON', 'Julia', 'Kotlin', 'LaTeX', 'Lua', 'MarkDown', 'MATLAB', 'Nginx', 'OCaml', - 'Octave', 'Pascal', 'Perl', 'PHP', 'Powershell', 'Python', 'Ruby', 'Rust', 'Shell', 'SQL', 'Swift', - 'TypeScript', 'VBScript', 'VB.NET', 'XML', 'YAML', + 'Octave', 'Pascal', 'Perl', 'PHP', 'Powershell', 'Python', 'Ruby', 'Rust', 'Shell', 'Smarty', 'SQL', 'Swift', + 'Twig', 'TypeScript', 'VBScript', 'VB.NET', 'XML', 'YAML', ]; @endphp