cmark

My personal build of CMark ✏️

Commit
04539263eaeb06629a49fc5d531166e84162dd84
Parent
39c69d0529a8578e3f30e4409d7e571a7730f3f3
Author
John MacFarlane <jgm@berkeley.edu>
Date

Slight improvement of clarity of logic in emph matching.

Diffstat

1 file changed, 10 insertions, 9 deletions

Status File Name N° Changes Insertions Deletions
Modified src/inlines.c 19 10 9
diff --git a/src/inlines.c b/src/inlines.c
@@ -538,15 +538,16 @@ static void process_emphasis(subject *subj, delimiter *stack_bottom) {
       odd_match = false;
       while (opener != NULL && opener != stack_bottom &&
              opener != openers_bottom[closer->delim_char]) {
-        // interior closer of size 2 can't match opener of size 1
-        // or of size 1 can't match 2
-        odd_match = (closer->can_open || opener->can_close) &&
-                    ((opener->length + closer->length) % 3 == 0);
-        if (opener->delim_char == closer->delim_char && opener->can_open &&
-            !odd_match) {
-          opener_found = true;
-          break;
-        }
+	if (opener->can_open && opener->delim_char == closer->delim_char) {
+          // interior closer of size 2 can't match opener of size 1
+          // or of size 1 can't match 2
+          odd_match = (closer->can_open || opener->can_close) &&
+                      ((opener->length + closer->length) % 3 == 0);
+          if (!odd_match) {
+            opener_found = true;
+            break;
+          }
+	}
         opener = opener->previous;
       }
       old_closer = closer;