summaryrefslogtreecommitdiff
path: root/src/inlines.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-08-07 12:55:12 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-08-07 12:55:12 -0700
commit1633fce60d3f2ca5d3450da03c9f752fcdf2b634 (patch)
tree63b0ea89301ffecb211f26b20768699e93b440ce /src/inlines.c
parentcf2f192486c85b6c7902d84dada3411e958c18b8 (diff)
Fixed `--hardbreaks` with CRLF line breaks.
Closes #68.
Diffstat (limited to 'src/inlines.c')
-rwxr-xr-xsrc/inlines.c11
1 files changed, 8 insertions, 3 deletions
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) == ' ' &&