Italics in italics

Opening caveat: this may be a request to breach the norms of markdown itself, and I apologize for the sin. Oh Daring Fireball, forgive me.

Use case or problem

I would like *this _string_ of text* to render as this string of text.

Instead, what happens is that the second level of italics ends the first: *this _string_ of text* actually render as this _string of text*, so that the first * and the second _ wrap the emphasized span, while the first _ and the second * simply become displayed characters.

Proposed solution

*…* and _…_ for italics would operate separately: _ would not close *, and * should not close _.

When one wrapper is within the other, it would generate a new nested span. The string above would be marked up as <span class="cm-em">this <span class="cm-em">string</span> of text</span>. This would mean that I could format emphasized text within emphasized text however I like: perhaps, like above, I could make the nested emphasized text roman, or I could make it bold, or underlined, or anything else. But it would be apparent that the nested emphasized text is emphasized.

Note that this is how the editor here on the forum works: this string of text results in <em>this <em>string</em> of text</em>.

Current workaround (optional)

I have not yet tested converting with pandoc to see what happens, but that would only solve the export side of this. It would not solve the appearance within Obsidian.

1 Like

I don’t know if I like this, but I admire it?

Another related problem, though, is that:

_this <span class="cm-em">string</span> of text_

still simply results in

CleanShot 2023-01-26 at 14.20.19

I.e., nested emphases don’t currently cancel each other out.

Still, I suppose that is just an appearance issue. It could be styled to suit this request with CSS, e.g.,

em span.cm-em {
      font-style: normal;
}

This is probably a good workaround for now? Use <em> tags within your nested italics?

Oh the <em> tags make a lot of sense and I forgot I had that affordance!

Yeah, I think it makes sense that the default would be

CleanShot 2023-01-26 at 14.20.19

but it would be nice to have the opportunity to change the styling with CSS.

The primary use case in my experience is when I’ve written a block of text that includes italics, and then decide to italicize the entire paragraph – while choosing to maintain the same internal emphasis

The above CSS works as-is for this!