summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-04-27 22:56:56 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-04-27 22:56:56 -0700
commit9b806e05e4b81b213714a9f9e5020486d0602a00 (patch)
tree7a66e68edece8bc61db36880ddb19b0d71d7ab2c
parent42ec0dedaa3bb770a689603c52c12a4c6295b0b2 (diff)
Fixed _ emphasis parsing to conform to spec.
See jgm/CommonMark#317.
-rw-r--r--src/inlines.c6
1 files changed, 4 insertions, 2 deletions
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;