Adding lean4 as language
Hi, Thanks for the amazing streamlit code editor. I would like to add lean4 as a language in the option lang, which is currently not there as it seems.
The community has made highlightjs-lean. Can you pls share on how to add this language for lang? Please share what other resources might be needed to get it to work.
The react-syntax-highlighter repo seems unmaintained so this issue has yet to be resolved.
Thanks in advance!
That would be super useful, agreed!!
Thanks for the reminder.
I probably wont be able to work on this anytime soon. If you want to add the language, there are a few steps and somewhat of a learning curve. If I were to do it myself, I would try to use AI to do it.
Here are the resources you need:
Steps:
- Create a fork of my fork of
ace-builds - Go to
ace-builds > src-noconflictin your fork (of my fork) - Add
mode-lean4.jsfile - Use the resources above and refer to other
mode-*.jsfiles as examples (maybe feed AI a couple of these files as examples in addition to the resource with instructions) to help you code this file. - Add
lean4toext-modelist.jsfile in the same directory. - Add the new mode file you created (
mode-lean4.js) toace-modules.d.tsand the resolvers (webpack-resolver.jsandesm-resolver.js) in the main directoryace-builds. - Once you get it working, submit a pull-request to my fork.
I think that should be it. The last steps 5-6 should be easy, because you can follow the pattern used for all the other mode files and you probably have to only add like one line per file. AI should be capable of this task.
I only mention using AI because there are clear rules to follow and AI usually does better when you can feed it detailed rules and examples and also, the fastest way is probably to use AI unless you have experience with this.
What the above steps accomplish is wrapping the parts of the code with span tags with classes assigned. The first resource covers this. The last remaining thing to do is add CSS with those class names. This is the part I am not sure about. It think maybe its best to use the CSS used by other languages (since most programming languages have the same types of tokens..like comments, functions, definitions etc)