| 264 | } |
| 265 | |
| 266 | fn horizontal_rule<'a, 'b>( |
| 267 | mut o: impl Write + 'b, |
| 268 | state: &'b mut ParseState, |
| 269 | ) -> impl FnMut(&mut Partial<&'a str>) -> PResult<(), Error<'a>> + 'b { |
| 270 | move |i| { |
| 271 | if !state.newline { |
| 272 | return Err(ErrMode::from_error_kind(i, ErrorKind::Fail)); |
| 273 | } |
| 274 | |
| 275 | ( |
| 276 | space0, |
| 277 | alt((take_while(3.., '-'), take_while(3.., '*'), take_while(3.., '_'))), |
| 278 | ) |
| 279 | .parse_next(i)?; |
| 280 | |
| 281 | state.column = 0; |
| 282 | state.set_newline = true; |
| 283 | |
| 284 | let rule_width = state.terminal_width.unwrap_or(DEFAULT_RULE_WIDTH); |
| 285 | queue(&mut o, style::Print(format!("{}\n", "━".repeat(rule_width)))) |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | fn code<'a, 'b>( |
| 290 | mut o: impl Write + 'b, |