- Commit
- 1633fce60d3f2ca5d3450da03c9f752fcdf2b634
- Parent
- cf2f192486c85b6c7902d84dada3411e958c18b8
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Fixed `--hardbreaks` with CRLF line breaks.
Closes #68.
My personal build of CMark ✏️
Fixed `--hardbreaks` with CRLF line breaks.
Closes #68.
1 file changed, 8 insertions, 3 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | src/inlines.c | 11 | 8 | 3 |
diff --git a/src/inlines.c b/src/inlines.c @@ -939,11 +939,16 @@ match: } // Parse a hard or soft linebreak, returning an inline. -// Assumes the subject has a newline at the current position. +// Assumes the subject has a cr or newline at the current position. static cmark_node *handle_newline(subject *subj) { bufsize_t nlpos = subj->pos; - // skip over newline - advance(subj); + // skip over cr, crlf, or lf: + if (peek_at(subj, subj->pos) == '\r') { + advance(subj); + } + if (peek_at(subj, subj->pos) == '\n') { + advance(subj); + } // skip spaces at beginning of line skip_spaces(subj); if (nlpos > 1 && peek_at(subj, nlpos - 1) == ' ' &&