cx.addElement from the inline parser of the Markdown language, doesn’t add elements depending of the order they are added, it doesn’t give any errors, and I couldn’t find any thing in the reference documentation that would reason with this.
In this case, where I first add a Elementfrom 0 to 7, and then add a Elementfrom 1 to 6, it seems to work as intended.
The way I am achieving this is by recreating the current emphasis parsing system to fit my needs, the current parser first incorrectly parses the delimiters, which then gets correctly parsed inside of resolveMarkers at the end of the parser cycle.
I have a similar system, where I recreate this whole parsing system inside of the extension architecture of the lezer markdown parser, and modify this system to fit my needs. At the end I am left with a list of elements which I need to then add the to parser using cx.addElement. And trying to add these elements caused the problem.
This doesn’t seem to be a problem in the current default parser as resolveMarkers replaces the element list after everything is parsed, rather than adding these elements at post as I am trying to(I can’t find exactly where this happens, but resolveMarkers is required for parsing to correctly work, and it is referenced inside of parseInline which itself is is referenced inside of finishLeaf, where I am guessing this really happens):
Hmm… Yeah, it most likely is the case which I haven’t accounted for. At-least in the default parser everything is wrapped inside of each other which I didn’t account for as my implementation had overridden this part, in favour of the requirements. Thanks a lot.
Also could I use injectMarks, to insert these marking together, seems like this is meant to do this exact thing, but I can’t say for sure. Or would I create a custom function to do this: