- Commit
- b9c7a496ba7dd9c3495bae2ff2855899e47b245d
- Parent
- 61b51fa7c8ec635eee19a16c6aa38c39093a0572
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
--smart: open quote can never occur right after `]` or `)`.
Closes #227.
My personal build of CMark ✏️
--smart: open quote can never occur right after `]` or `)`.
Closes #227.
2 files changed, 11 insertions, 1 deletion
Status | File Name | N° Changes | Insertions | Deletions |
Modified | src/inlines.c | 3 | 2 | 1 |
Modified | test/smart_punct.txt | 9 | 9 | 0 |
diff --git a/src/inlines.c b/src/inlines.c @@ -345,7 +345,8 @@ static int scan_delims(subject *subj, unsigned char c, bool *can_open, *can_close = right_flanking && (!left_flanking || cmark_utf8proc_is_punctuation(after_char)); } else if (c == '\'' || c == '"') { - *can_open = left_flanking && !right_flanking; + *can_open = left_flanking && !right_flanking && + before_char != ']' && before_char != ')'; *can_close = right_flanking; } else { *can_open = left_flanking;
diff --git a/test/smart_punct.txt b/test/smart_punct.txt @@ -78,6 +78,15 @@ left double quote, to facilitate this style: <p>“Second paragraph by same speaker, in fiction.”</p> ```````````````````````````````` +A quote following a `]` or `)` character cannot +be an open quote: + +```````````````````````````````` example +[a]'s b' +. +<p>[a]’s b’</p> +```````````````````````````````` + Quotes that are escaped come out as literal straight quotes: