I want to add syntax highlighting for my text format to codemirror, but I am inexperienced with parsing. I saw that the markdown language repo mentions that lezer isn’t appropriate for parsing markdown. Before I try to figure out Lezer, I’m wondering if you think my format is suitable to be parsed that way, or what other technique I might try.
This is the format used in my product, tasktxt.com, I hope to migrate the editor to use codemirror.
My format is like this:
A line preceded by two blank lines (or the start of the document) is considered a “task”. Any lines following this line are “notes” for that task, unless there are two blank lines, in which case the line after that is a separate task. The notes are just text, but the first line of a task has several items that should be parsed within it.
this is the first task these are notes about the first task these are notes about about the first task [x] this is the second task this is the third task 10m
The first line of the task has these components:
- an optional ‘checkbox’
- any text
- an optional guess duration in the format
- a divider followed by an optional duration, and timestamp
/ 1m [10:00:00am]
The tricky thing for me is that the “text” portion can have things that look like durations or timestamps within it. For example:
this is some text 5m / 1m [10:00:00am] more text 10m / 20s [12:30:00am]
In that example, the portion that says
5m / 1m [10:00:00am] is part of the plain old text, it’s not parsed, but the later
10m / 20s [12:30:00am] is meant to be parsed.
I hope that is clear enough and I’d be very grateful for any pointers on this, thank you.