Overlapping emphasis tags

How should this example be parsed?:

*test _test* test_

Reference parser treats it as *test <em>test* test</em> right now, but I didn’t find anything about this behavior in the spec.

1 Like

There are two issues on github regarding this: [Underscores inside of emphasis.] (https://github.com/jgm/stmd/issues/51) and Inconsistency in the spec regarding nested emphasis of the same type and @jgm has mentioned that this is something that needs to be fixed both in specification and the reference implementations.

I prefer <em>test _test</em> test_, mainly because it follow the left-to-right rule mentioned in the specification. It also seems much better for the parser that wants to avoid backtracking - as soon as it finds a match, it creates the emphasis instead of searching till the very end if there is a closing _.

2 Likes