raw
1use nom::{
2 IResult, Parser,
3 branch::alt,
4 character::complete::{char, space0},
5 combinator::map,
6 multi::{many, many_m_n},
7 sequence::{preceded, terminated},
8};
9
10use crate::parser::util::line_terminated;
11
12pub(super) fn thematic_break<'a>() -> impl FnMut(&'a str) -> IResult<&'a str, ()> {
13 move |input: &str| {
14 map(
15 line_terminated(preceded(
16 many_m_n(0, 3, char(' ')),
17 terminated(
18 alt((
19 many(3.., char('-')),
20 many(3.., char('_')),
21 many(3.., char('*')),
22 )),
23 space0,
24 ),
25 )),
26 |_: Vec<_>| (),
27 )
28 .parse(input)
29 }
30}
31