snarkdown icon indicating copy to clipboard operation
snarkdown copied to clipboard

Snake_case underscores create italics

Open jacobmischka opened this issue 8 years ago • 7 comments
trafficstars

This may be out of scope for this project, but snake_case currently will italicize case. I believe underscores should only create emphasis if they're surrounded by whitespace _like this_

Snarkdown: image

Commonmark: image

jacobmischka avatar May 11 '17 20:05 jacobmischka

Ah for sure. The parser can probably be tweaked to fix this.

developit avatar May 17 '17 06:05 developit

Actually hm, according to the original markdown post on daringfireball I think snarkdown's behavior here is correct. This might be a spec difference between commonmark and "traditional" markdown, I haven't yet read the commonmark spec on the subject to be sure.

If that is the case, I suppose it's up to you which one you want to support.

Regardless, thanks again! And no urgency on this or anything, of course.

jacobmischka avatar May 22 '17 15:05 jacobmischka

I see the value of skipping foo_bar for sure.

developit avatar Jun 03 '17 19:06 developit

It seems that single underscores in links are parsed too, which makes posting links difficult:

https://www.beyonk.com/uk/tohp-_/ben-nevis-guiding

becomes

https://www.beyonk.com/uk/tohp-/ben-nevis-guiding

I think this is an actual issue, since the phrase is not wrapped per-se, it's a single occurrence.

antony avatar Jul 11 '19 10:07 antony

Could reproduce this problem as well. Any plan to fix it soon?

ribeaud avatar Jul 26 '21 12:07 ribeaud

Note that there is a lot of specifics in CommonMark that you may not want to implement in a single regex:

AS~~asdsa~~.   
AS_ASD_  
AS__ASD_  
AS*ASD**  
AS*ASD*     (x)  
AS*ASD  
**A*  

Rendered:

image

A tiny library may ship with certain limitations.

nikku avatar Jul 27 '21 12:07 nikku

Not wanting to implement every edge-case shouldn't prevent to handle common cases, right?

We can live with some differences with CommonMark, but breaking links due to a single underscore is a little harder to live with.

Can #101 be considered?

yanndinendal avatar Feb 06 '23 15:02 yanndinendal