diff --git a/org_mode_samples/greater_element/footnote_definition/empty_space_before_and_after_content.org b/org_mode_samples/greater_element/footnote_definition/empty_space_before_and_after_content.org index 1d2113e..6862213 100644 --- a/org_mode_samples/greater_element/footnote_definition/empty_space_before_and_after_content.org +++ b/org_mode_samples/greater_element/footnote_definition/empty_space_before_and_after_content.org @@ -6,4 +6,3 @@ baz #+END_EXAMPLE - diff --git a/src/parser/footnote_definition.rs b/src/parser/footnote_definition.rs index e413d9d..be8b0e3 100644 --- a/src/parser/footnote_definition.rs +++ b/src/parser/footnote_definition.rs @@ -4,8 +4,10 @@ use nom::bytes::complete::tag_no_case; use nom::bytes::complete::take_while; use nom::character::complete::digit1; use nom::character::complete::space0; +use nom::combinator::opt; use nom::combinator::recognize; use nom::combinator::verify; +use nom::multi::many0; use nom::multi::many1; use nom::multi::many_till; use nom::sequence::tuple; @@ -41,8 +43,15 @@ pub fn footnote_definition<'b, 'g, 'r, 's>( } start_of_line(input)?; // Cannot be indented. - let (remaining, (_lead_in, lbl, _lead_out, _ws)) = - tuple((tag_no_case("[fn:"), label, tag("]"), space0))(input)?; + let (remaining, (_, lbl, _, _, _)) = tuple(( + tag_no_case("[fn:"), + label, + tag("]"), + space0, + opt(verify(many0(blank_line), |lines: &Vec>| { + lines.len() <= 2 + })), + ))(input)?; let contexts = [ ContextElement::ConsumeTrailingWhitespace(true), ContextElement::Context("footnote definition"),