Check that there is blank space after the ending asterisk.

This commit is contained in:
Tom Alexander 2022-12-11 02:24:19 -05:00
parent 48942d2b45
commit 50a57ef15b
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 12 additions and 1 deletions

View File

@ -22,11 +22,13 @@ use super::text::TextElement;
use super::token::Token;
use super::Context;
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::bytes::complete::take;
use nom::combinator::cond;
use nom::combinator::eof;
use nom::combinator::map;
use nom::combinator::not;
use nom::combinator::peek;
use nom::combinator::recognize;
use nom::error::ErrorKind;
use nom::error::ParseError;
@ -166,7 +168,16 @@ pub fn context_bold_start<'s, 'r>(
}
pub fn context_bold_end<'s, 'r>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
recognize(bold_end)(input)
let (remaining, actual_match) = recognize(bold_end)(input)?;
peek(alt((
// Must have whitespace after the end asterisk or it must be the end of that section (as checked by the fail matcher)
tag(" "),
tag("\t"),
tag("\n"),
|i| context.check_fail_matcher(i)
)))(remaining)?;
Ok((remaining, actual_match))
}
pub fn paragraph<'s, 'r>(