Guidance on extending Markdown with a white-space dependent syntax

I’m trying to make a text editor for the bespoke way I keep track of my todo list, something like Org.mode, but worse. I was looking at the lezer-parser/markdown docs, but my syntax for tasks is different because I make lots of tasks and routinely break them into subtasks. I also add updates prefixed with a date and metadata.

# Boat Filing Cabinet
This is a new variant of the BoatBox Mark IV deployed in 1872.

## Electrical Design
[x] Schematic design by 6/1/23
    These be the 4102-123-S1.
    8/13/23 Still waiting on response.
    8/1/23 Assigned to Joe.
    [x] Initial drafts
    [x] Review
        Assigned: Margo
        8/12/23 Warned her that this will be different than the pyschonautic gel.
    [x] Release
[ ] Board layout by 7/14/23
    Snooze: 7/1/23
    [x] SOW
    [ ] Send design package
    [ ] Archive artwork
[ ] Fabricate gen. 1 boards

## Test Program
The qualification program only adds 1 test from the previous unit.

[x] Book fungus test
    6/15/23 Booked the test for 8/17/23. PO is 1241253-1
[ ] Run fungus test on 8/17/23
[ ] Complete fungus test by 9/1/23

# Yo-yo Rocket Boots
[x] Hold kick-off meeting to rough-out schedule by 4/4/24
[x] Party

I had been following the indentation example, because this felt like a very heavily indentation-based syntax to determine what is a child of what. In my UI, I’d like to be able to decorate the text heavily to make it easy for me to focus, and have the system understand what is coming up and what’s overdue from the metadata. The end result would look something like this in codemirror, with a pane beside it showing health of the todo-list: what’s overdue, what’s due soon, what hasn’t had a status update in the last week.

# (0/2) Boat Filing Cabinet
This is a new variant of the BoatBox Mark IV deployed in 1872.

## (1/3) Electrical Design
[ ] (1/3) Board layout by 7/14/23
    Snooze: 7/1/23
    [x] SOW
    [ ] Send design package
    [ ] Archive artwork
[ ] Fabricate gen. 1 boards

## (1/3) Test Program
The qualification program only adds 1 test from the previous unit.

[ ] Run fungus test on 8/17/23
[ ] Complete fungus test by 9/1/23

# (2/2) Yo-yo Rocket Boots

I’ve gotten into a bit of decision paralysis on if the right thing to do is extend the markdown plugin, or to start with my own custom syntax and build mark-down-like behavior into that? I would appreciate any pointers and guidance on how you might approach it. I think maybe the sub-line metadata (like “Do something by 8/23/23” would be beyond the scope of the lezer grammar) but maybe not? The task list is a few thousand lines long, so incremental parsing seems like a good idea.

This seems sufficiently different from Markdown that squeezing it into the Markdown parser might indeed be hard. But also, these kinds of formats tend to be tricky to squeeze into an LR grammar. So I don’t really have a good suggestion. If the format is as line-based as it looks in your examples, maybe an LR parser with external tokenizers that do a bunch of scanning of the current line would work.

That makes me feel better that I’m not missing something trivial, thanks. :slight_smile:

Does it make sense to use the approach of the indentation-based-language example, but modify the context tracker to change the IndentLevel depth both for indentation and when a new heading line is seen?

I don’t know—I don’t know this language as well as you know it. It’s your project.