From 1633fce60d3f2ca5d3450da03c9f752fcdf2b634 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 7 Aug 2015 12:55:12 -0700 Subject: Fixed `--hardbreaks` with CRLF line breaks. Closes #68. --- src/inlines.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/inlines.c') diff --git a/src/inlines.c b/src/inlines.c index f8e2575..f8a2cfc 100755 --- 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) == ' ' && -- cgit v1.2.3