- Commit
- 9b806e05e4b81b213714a9f9e5020486d0602a00
- Parent
- 42ec0dedaa3bb770a689603c52c12a4c6295b0b2
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Fixed _ emphasis parsing to conform to spec.
See jgm/CommonMark#317.
My personal build of CMark ✏️
Fixed _ emphasis parsing to conform to spec.
See jgm/CommonMark#317.
1 file changed, 4 insertions, 2 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | src/inlines.c | 6 | 4 | 2 |
diff --git 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;