From 06156fd9194806ab98889e5ef3a309bb7075b02c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 8 Jan 2017 00:17:53 +0100 Subject: Update emphasis parsing for spec change. Strong now goes inside Emph rather than the reverse, when both scopes are possible. The code is much simpler. This also avoids a spec inconsistency that cmark had previously: `***hi***` became Strong (Emph "hi")) but `***hi****` became Emph (Strong "hi")) "*" --- src/inlines.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/inlines.c') diff --git a/src/inlines.c b/src/inlines.c index 92e79c7..3807da9 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -614,12 +614,7 @@ static delimiter *S_insert_emph(subject *subj, delimiter *opener, cmark_node *tmp, *tmpnext, *emph; // calculate the actual number of characters used from this closer - if (closer_num_chars < 3 || opener_num_chars < 3) { - use_delims = closer_num_chars <= opener_num_chars ? closer_num_chars - : opener_num_chars; - } else { // closer and opener both have >= 3 characters - use_delims = closer_num_chars % 2 == 0 ? 2 : 1; - } + use_delims = (closer_num_chars >= 2 && opener_num_chars >=2) ? 2 : 1; // remove used characters from associated inlines. opener_num_chars -= use_delims; -- cgit v1.2.3