def-gthill / lexurgy

A high-powered sound change applier
GNU General Public License v3.0
42 stars 5 forks source link

Inquiry on syntax highlighting in the web app #79

Closed Neonnaut closed 5 days ago

Neonnaut commented 2 weeks ago

Hi Graham.

I've been making my own syntax highlighter for something called Lexifer. neonnaut.github.io/lexifer.html. Even though I have achieved this by placing a div over the textbox using CSS grid, I noticed that your web app lexurgy-app.vercel.app/sc doesn't do this. Your web app uses a contentedible div instead.

But when I tried using a contentedible div, I ran into two big problems. Text that was pasted into the div retained its formatting, and the caret would jump to the end of the text in the div. Your web app doesn't do this.

How did you achieve this?

def-gthill commented 2 weeks ago

I used CodeMirror. I have no idea how they get it all to work so smoothly, but thankfully I don't have to, someone's already figured it all out.

Neonnaut commented 2 weeks ago

How did you add your own language module?

def-gthill commented 2 weeks ago

https://codemirror.net/examples/lang-package/

Neonnaut commented 1 week ago

Okay I know this isn't the place to ask this, but I'm having trouble writing a .grammar doc. I have comments and numbers figured out. I know there are the docs, examples and lezer-playground.vercel.app, but they're all on very complicated languages, or very basic contextless languages to figure out how mine would work on a basic level.

If only I had a small template that did the following:

A set of functions that are highlighted at the beginning of a line disregarding whitespace, and preceding an indent A set of keywords that are highlighted following a function on the same line A set of characters (";" and "+"), that are highlighted following a function on the same line

   function1: keyword1 kyword2
function2: ab;c+d
def-gthill commented 6 days ago

You're correct that this isn't the place to ask. If you have specific questions about why something isn't working the way you expect, I can try to answer them.