We’ve just added syntax highlighting for Lean to the online editor.
In addition to syntax highlighting, the editor now supports the same \ abbreviations as the Lean VS Code extension. For example, you can type \to to get →.
Here are some screenshots showing how the highlighting and symbols currently appear in the editor under the Dark, Light, and Accessibility Dark themes:
Though I’m (currently) very ignorant about Lean, and know little about the online editor, you really got my attention with the bit about \ abbreviations.
Julia uses these LaTeX-to-Unicode shortcuts extensively, but we never implemented this feature in the editor. Is this something that could be copied across tracks?
Julia uses these LaTeX-to-Unicode shortcuts extensively, but we never implemented this feature in the editor. Is this something that could be copied across tracks?
First, a disclaimer: the Lean CodeMirror plugin was written by Claude. I designed and reviewed the code, but didn’t write it.
I asked Claude to add the shortcuts to the highlighting plugin and to give me a playground page where I could try them out. In that first version, a small list of shortcuts was hardcoded into the plugin.
After a few iterations, we discussed expanding the list to include all of the VS Code extension’s shortcuts. At that point, it was simpler to use @leanprover/unicode-input, the same npm package the extension uses.
I’m not aware of a similar ready-made npm package for Julia. But I asked Claude about it now and it seems Julia’s own source code contains the official list (stdlib/REPL/src/latex_symbols.jl, MIT-licensed). So I believe this list could be converted and bundled with the plugin.
You could consider adding other utilities too. For example, the Lean plugin also includes hover tips on how to use shortcuts to create a symbol: