From 9b806e05e4b81b213714a9f9e5020486d0602a00 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 27 Apr 2015 22:56:56 -0700 Subject: Fixed _ emphasis parsing to conform to spec. See jgm/CommonMark#317. --- src/inlines.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/inlines.c b/src/inlines.c index 3e298de..afe564c 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -301,8 +301,10 @@ scan_delims(subject* subj, unsigned char c, bool * can_open, bool * can_close) !utf8proc_is_space(after_char) && !utf8proc_is_punctuation(after_char)); if (c == '_') { - *can_open = left_flanking && !right_flanking; - *can_close = right_flanking && !left_flanking; + *can_open = left_flanking && + (!right_flanking || utf8proc_is_punctuation(before_char)); + *can_close = right_flanking && + (!left_flanking || utf8proc_is_punctuation(after_char)); } else if (c == '\'' || c == '"') { *can_open = left_flanking && !right_flanking; *can_close = right_flanking; -- cgit v1.2.3