Remove leading blank lines from document contents.
This commit is contained in:
@@ -181,8 +181,10 @@ fn _document<'b, 'g, 'r, 's>(
|
||||
let zeroth_section_matcher = parser_with_context!(zeroth_section)(context);
|
||||
let heading_matcher = parser_with_context!(heading(0))(context);
|
||||
let (remaining, _blank_lines) = many0(blank_line)(input)?;
|
||||
let contents_begin = remaining;
|
||||
let (remaining, zeroth_section) = opt(zeroth_section_matcher)(remaining)?;
|
||||
let (remaining, children) = many0(heading_matcher)(remaining)?;
|
||||
let contents = get_consumed(contents_begin, remaining);
|
||||
let source = get_consumed(input, remaining);
|
||||
Ok((
|
||||
remaining,
|
||||
@@ -192,6 +194,11 @@ fn _document<'b, 'g, 'r, 's>(
|
||||
path: None,
|
||||
zeroth_section,
|
||||
children,
|
||||
contents: if contents.len() > 0 {
|
||||
Some(Into::<&str>::into(contents))
|
||||
} else {
|
||||
None
|
||||
},
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user