From f7c8db7588573f3b0de166166a6f6756baf222dc Mon Sep 17 00:00:00 2001 From: Martin Mitas Date: Fri, 14 Jan 2022 11:04:02 +0100 Subject: [PATCH] md_rollback: Fix dummization of virtual closers. Fixes #173. --- src/md4c.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/md4c.c b/src/md4c.c index a3cec1ce..3677c0e0 100644 --- a/src/md4c.c +++ b/src/md4c.c @@ -2693,10 +2693,11 @@ md_rollback(MD_CTX* ctx, int opener_index, int closer_index, int how) /* And reset our flags. */ if(discard_flag) { - mark->flags &= ~(MD_MARK_OPENER | MD_MARK_CLOSER | MD_MARK_RESOLVED); /* Make zero-length closer a dummy mark as that's how it was born */ if((mark->flags & MD_MARK_CLOSER) && mark->beg == mark->end) mark->ch = 'D'; + + mark->flags &= ~(MD_MARK_OPENER | MD_MARK_CLOSER | MD_MARK_RESOLVED); } /* Jump as far as we can over unresolved or non-interesting marks. */ @@ -3938,7 +3939,7 @@ md_analyze_permissive_url_autolink(MD_CTX* ctx, int mark_index) /* Ok. Lets call it an auto-link. Adapt opener and create closer to zero * length so all the contents becomes the link text. */ MD_ASSERT(closer->ch == 'D' || - (ctx->parser.flags & MD_FLAG_PERMISSIVEWWWAUTOLINKS && + ((ctx->parser.flags & MD_FLAG_PERMISSIVEWWWAUTOLINKS) && (closer->ch == '.' || closer->ch == ':' || closer->ch == '@'))); opener->end = opener->beg; closer->ch = opener->ch;