Testing nested emphasis

It is similar to Nested emph and strong in Babelmark 2, but more exhaustive:

- 1 in 1: *some text *emphasized* again*

- 1 in 2: **some text *emphasized* again**

- 1 in 3: ***some text *emphasized* again***

- 2 in 1: *some text **emphasized** again*

- 2 in 2: **some text **emphasized** again**

- 2 in 3: ***some text **emphasized** again***

- 3 in 1: *some text ***emphasized*** again*

- 3 in 2: **some text ***emphasized*** again**

- 3 in 3: ***some text ***emphasized*** again***


See Babelmark 2 - Compare markdown implementations

About the results:

  • IMO as long as there’s some asterisks in the rendering, it is wrong.
  • Those that do not include any asterisk in the results can be categorized in:
    • commonmark 0.24.0 and others
      • It is interesting to see the lastest CommonMark treated emphasis almost as styling, in “1 in 1”, “2 in 2” and “3 in 3”, the inner emphasis hasn’t been emphasized from the surround text.
    • RDiscount 1.6.8 and others
      • The 2 nesting levels are treated as addition first and if it exceeds 3, it becomes a difference between the 2.
    • cebe/markdown GFM 1.1.0 and others
      • “2 in 3” inner wordings are not emphasized.

So the only one “get it right” (treating emphasis between emphasis as another emphasis within the surrounding texts) is RDiscount 1.6.8 (and s9e\TextFormatter (Fatdown/PHP)).

It seems no one is discussing this here. But to me CommonMark’s interpretation seems wrong, and RDiscount (and the other one)'s are the correct one. Should this be added to the Issues to resolve before 1.0 release?

I disagree about what counts as getting it right here. CommonMark is getting it right.

Let’s distinguish the issue of structure from the issue of rendering. The structure you want from 2 in 3 is

    "some text "
    " again"

and CommonMark gets that, representing it in the natural way in HTML.

If you want the strong inside strong to be rendered as non-bold, that’s something that should be handled with CSS, not by rewriting the structure as discount does.

1 Like