Hello everyone,
I would like to use this javascript library (https://highlightjs.org) in my NB app., to easily edit LUA code. However, I have never done this before. I have trouble setting with the thing. Someone would be kind enough to help me ? I would just like to load an LUA code editor into a NeoBook WebBrowser object. So, I would need (I guess...) an HTML page, with a piece of code required to display the thing (?).
The site offers to download a small package, with the language of our choice.
So, for me, only the LUA language is required : https://highlightjs.org/download/
Your help would be welcome.
Of course, if you know another javascript library (or another method), easier and/or better for edit the LUA code, I am waiting for your feedback.
Thank you very much.
Use Javascript library : please need help
Moderator: Neosoft Support
-
- Posts: 419
- Joined: Thu Oct 15, 2009 3:43 pm
Re: Use Javascript library : please need help
You need an editor with code highlight (Ace/Scintilla/EditArea etc...), not just regular static code highlighter.
Re: Use Javascript library : please need help
UltraVox:
1) I do not have experience with "highlighter", but it appears to be just a facility to "highlight" code (written in many different languages) ... I do not think it is a "text editor" i.e. I do not believe you can make/save changes to the highlighted code ... almost all things that run inside Browsers can NOT save to files on your local disk (for security reasons).
Even this YouTube Tutorial ... https://www.youtube.com/watch?v=y-0jqM9EeVM ... uses Notepad+ to setup the demo HTML file.
2) What is your purpose for running this "hilighter" inside a WebBrowser object ? ... as opposed to viewing it stand-alone (as an HTML file within your Browser) ?
Do you need to send Lua code to this "highlighter" from your NeoBook application ? ... according to this page ... https://highlightjs.org/usage/ ... you have to insert your code between <pre> and </pre> tags in your html file ... so, assuming that you ...
a) only need to highlight your code (not edit/save it)
b) have manged to make "highlighter" work as a standalone file
... you would just need to specify this html file (your code surrounded by html/javascript) in order to view it inside a WebBrowser object ... if you want to avoid this process of wrapping html/javascript manually, then you would have to setup a template file ... and then each time, use NeoBook commands to ...
a) do the insertion/replacement of your Lua code in the template
b) save the modified template to another temporary file
c) view the temporary file in your WebBrowser object
1) I do not have experience with "highlighter", but it appears to be just a facility to "highlight" code (written in many different languages) ... I do not think it is a "text editor" i.e. I do not believe you can make/save changes to the highlighted code ... almost all things that run inside Browsers can NOT save to files on your local disk (for security reasons).
Even this YouTube Tutorial ... https://www.youtube.com/watch?v=y-0jqM9EeVM ... uses Notepad+ to setup the demo HTML file.
2) What is your purpose for running this "hilighter" inside a WebBrowser object ? ... as opposed to viewing it stand-alone (as an HTML file within your Browser) ?
Do you need to send Lua code to this "highlighter" from your NeoBook application ? ... according to this page ... https://highlightjs.org/usage/ ... you have to insert your code between <pre> and </pre> tags in your html file ... so, assuming that you ...
a) only need to highlight your code (not edit/save it)
b) have manged to make "highlighter" work as a standalone file
... you would just need to specify this html file (your code surrounded by html/javascript) in order to view it inside a WebBrowser object ... if you want to avoid this process of wrapping html/javascript manually, then you would have to setup a template file ... and then each time, use NeoBook commands to ...
a) do the insertion/replacement of your Lua code in the template
b) save the modified template to another temporary file
c) view the temporary file in your WebBrowser object
Re: Use Javascript library : please need help
Hum, Thanks for your advices, Gaev and Tony.
Obviously, Highlight.js is not what I'm looking for !
I am looking for a free tool, redistributable (so, probably open-source and with an appropriate license) that can Open a .lua file, edit it, modify it and save it, if possible with a customizable appearance (Colors, Fonts ...), as in Pro code editors.
I do not care if it's done in a WebBrowser object, a Rectangle, or whatever you want. The important thing is that it works properly and that it is legal.
Obviously, Highlight.js is not what I'm looking for !
I am looking for a free tool, redistributable (so, probably open-source and with an appropriate license) that can Open a .lua file, edit it, modify it and save it, if possible with a customizable appearance (Colors, Fonts ...), as in Pro code editors.
I do not care if it's done in a WebBrowser object, a Rectangle, or whatever you want. The important thing is that it works properly and that it is legal.
Re: Use Javascript library : please need help
UltraVox:
On the (rare) occasions that I need to create/edit html/javascript files, I use SciTE (a Text Editor that uses the Scintilla engine).
You can download it from here ... https://www.scintilla.org/SciTE.html
On the (rare) occasions that I need to create/edit html/javascript files, I use SciTE (a Text Editor that uses the Scintilla engine).
... note that, the + and - references you made in earlier posts, is referred to as folding.SciTE currently is able to syntax style these languages (* denotes support for folding):
Abaqus*
Ada
ANS.1 MIB definition files*
APDL
Assembler (NASM, MASM)
Asymptote*
AutoIt*
Avenue*
Batch files (MS-DOS)
Baan*
Bash*
BlitzBasic*
Bullant*
C/C++/C#*
Clarion*
cmake*
COBOL
Coffeescript
conf (Apache)*
CSound*
CSS*
D
diff files*
E-Script*
Eiffel*
Erlang*
Flagship (Clipper / XBase)*
Flash (ActionScript)*
Fortran*
Forth*
GAP*
Gettext
Go*
Haskell
HTML*
HTML with embedded JavaScript, VBScript, PHP and ASP*
Gui4Cli*
IDL - both MSIDL and XPIDL*
INI, properties* and similar
InnoSetup*
Intel HEX*
Java*
JavaScript*
JSON and JSON-LD
KiXtart
LISP*
LOT*
Lout*
Lua*
Make
Matlab*
Maxima*
Metapost*
MMIXAL
MSSQL
Modula 3
Nimrod
nnCron
NSIS*
Objective C
Objective Caml*
Opal
Octave*
Pascal/Delphi*
Perl, most of it except for some ambiguous cases*
PL/M*
Progress*
PostScript*
POV-Ray*
PowerBasic*
PowerShell*
PowerPro
PureBasic*
Python*
R*
Rebol*
Registry
Ruby*
Rust
Scheme*
scriptol*
SORCUS Installation
Specman E*
Spice
Smalltalk
SQL and PLSQL
S-Record
Swift
TADS3*
TeX and LaTeX
Tcl/Tk*
Vala*
VB and VBScript*
Verilog*
VHDL*
XML*
YAML*
You can download it from here ... https://www.scintilla.org/SciTE.html
-
- Posts: 419
- Joined: Thu Oct 15, 2009 3:43 pm
Re: Use Javascript library : please need help
The easiest way would be download SciTE and run it in rectangle (and interact via SendKeys)
Re: Use Javascript library : please need help
Thank you Tony and Gaev, it works well.
This SciTE version is different from that of Gaev, right ?
Can it change the default theme ? My application is dark.
If you know how to change the theme, to put something darker, I'm interested.
Thank you for your help.
This SciTE version is different from that of Gaev, right ?
Can it change the default theme ? My application is dark.
If you know how to change the theme, to put something darker, I'm interested.
Thank you for your help.
Re: Use Javascript library : please need help
UltraVox:
If not, I advise that you ...
- examine the (text) files that were included in the downloaded package
- make a copy of the original file
- edit the approrpriate line to see what it does
SciTe is highly configurable ... the specific methods for doing so depend on the version that you downloaded (things change from version to version) ... don't know if the latest version has detailed help information about each of the properties/options.If you know how to change the theme, to put something darker, I'm interested.
If not, I advise that you ...
- examine the (text) files that were included in the downloaded package
- make a copy of the original file
- edit the approrpriate line to see what it does
Re: Use Javascript library : please need help
I downloaded this version :https://www.scintilla.org/wscite405.zip
And there are 82 *.properties files in the root of SciTE.exe ^^
So, I looked for themes for SciTE. I did not find anything beyond 2012-2014. And even less about the method for changing colors. All these .properties files contain color codes. Just find which one! lol
And there are 82 *.properties files in the root of SciTE.exe ^^
So, I looked for themes for SciTE. I did not find anything beyond 2012-2014. And even less about the method for changing colors. All these .properties files contain color codes. Just find which one! lol