How to make line based parsing of markdown as done before in CM 5

I am trying to recreate a simple markdown editor made with CM5 to CM6, one thing I found was that when trying to parse italics or bold, the parsing is not done line wise, but this I mean, something like *Italics with no ending word * shows decoration with CM5, but in CM6 is not parsed, for CM6 to parse this I would need to add a ending word like *Italics with an ending word*, note that the ending word and asterisk are joined.

Is there a way to archive this behavior with CM6?

The CM5 parser isn’t conforming to the CommonMark spec there, and the CM6 behavior is what you’ll get from your Markdown renderer, so this seems like an improvement.

I am trying to create a WYSIWG editor, in which changing italics isn’t ideal as it changes the text length, any pointers on how I may be able to achieve this behavior without recreating the parser using lazer?

Thanks.

It’s not clear to me what you’re trying to do, and how parsing the italics incorrectly is going to help.

Sorry, I may not have been clear, what I mean is, because the mark decoration changes when a user may put a space after a word to write another word, the decoration would be removed, as it wouldn’t be recognised by the parser.

Here is an example, using basicSetup with markdown language:
Screen-Recording-2022-04-11-at-1.55.47-PM

You can how this may be a problem when someone might be writing a paragraph. You can also see how towards the end of my gif, that the length of the decoration is much longer than without any decoration, which is also not ideal.

What I am trying to make is something like this(this is Obsidian, an closed source app also using CM6):
Screen-Recording-2022-04-11-at-2.13.56-PM

You can see that the parser here is not being exact when it comes to the ending of the line, you can see when there is a space between the word and ***, the parser is not removing the decoration as happening before.

I am not certain behind the logic here, on how the parser is working, as per my knowledge, this is very similar to CM5s parser, where if the starting *** is not ended, the ending is automatically assumed to be the end of the paragraph, as shown here:

If I where to want to use this whats my best bet? Right now I am working on creating a custom subpar parser, build on top of the default parser to do this, so the default parser states where paragraphs are on a plugin decoration extension, and from there I parser the paragraph using my custom parser using similar logic to the one given above.

Is there a better way to achieve this?

Thanks.

Can I achieve this with extension architecture of the Markdown lezer parser? I saw your comment here about it: CM6 StreamParser - #14 by marijn

If so, can you give me some guidance?

Maybe, but I don’t really have time to figure out how for you, sorry.

Thanks a lot. I will look into it.