added syntax highlighting

This commit is contained in:
Leon van Kammen 2024-12-16 19:15:18 +01:00
parent ca18c11eb3
commit a259387096
3 changed files with 11 additions and 2 deletions

View File

@ -32,7 +32,7 @@ help_tips(){
echo ""
echo 'TIPS'
echo '----'
echo 'text editors ' "type '<vi|mg|nano> <textfile>'"
echo 'text editors ' "type '<codemirror|vi|mg|nano> <textfile>'"
echo 'programming languages ' "type 'ls ~/bin/helloworld*'"
echo 'run 64bit linux app ' "type 'blink <x86_64 binary>'"
echo 'paste text ' "ctrl/cmd+shift+v'"

View File

@ -66,7 +66,13 @@ AFRAME.registerComponent('codemirror', {
this.el.setAttribute("window", `title: codemirror; uid: ${this.el.dom.id}; attach: #overlay; dom: #${this.el.dom.id}; width: ${this.data.width}px; height: ${this.data.height}px`)
this.editor = CodeMirror( this.el.dom, {
value,
mode: "htmlmixed",
mode: this.data.file.match(/\.js$/) ? "text/javascript" :
this.data.file.match(/\.css$/) ? "text/css" :
this.data.file.match(/\.html$/) ? "htmlmixed" :
this.data.file.match(/\.md$/) ? "markdown" :
this.data.file.match(/\.py$/) ? "python" :
this.data.file.match(/\.lua$/) ? "lua" :
"text/javascript",
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
@ -198,6 +204,9 @@ AFRAME.utils.require({
cmxml: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/xml/xml.js",
cmjavascript: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/javascript/javascript.js",
cmcss: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/css/css.js",
cmlua: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/lua/lua.js",
cmpython: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/python/python.js",
cmmarkdown: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/markdown/markdown.js",
highlight: "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.35.0/mode/htmlmixed/htmlmixed.js",
})
)

BIN
dist/v86-linux.iso vendored

Binary file not shown.