Y55SCAUN3MQCMRGJQBBMICEO6ARTGICWGGZYA7VB6ZRPK6US4B5AC pub fn preformatted(self, preformatted: impl Into<String>) -> Self {self.push(Doc::Preformatted(preformatted.into()))
pub fn preformatted(self, alt: Option<impl Into<String>>, text: impl Into<String>) -> Self {let alt = alt.map(Into::into);let text = text.into();self.push(Doc::Preformatted { alt, text })
pub fn text(input: &str) -> IResult<&str, Doc> {map(line, |s: &str| {if s.is_empty() {Doc::Blank} else {Doc::Text(s.to_string())}})(input)
fn text(input: &str) -> IResult<&str, Doc> {context("gemtext text line",map(line, |s: &str| {if s.is_empty() {Doc::Blank} else {Doc::Text(s.to_string())}}),)(input)
map(preceded(pair(tag("=>"), space1), terminated(body, line_ending)),|(to, name): (&str, Option<&str>)| Doc::Link {to: to.to_string(),name: name.map(|s| s.to_string()),},
context("gemtext link line",map(preceded(pair(tag("=>"), space1), terminated(body, line_ending)),|(to, name): (&str, Option<&str>)| Doc::Link {to: to.to_string(),name: name.map(|s| s.to_string()),},),
map_res(peek(take(3usize)), |s| {Ok(match s {"###" => Level::Three,_ if s.starts_with("##") => Level::Two,_ if s.starts_with("#") => Level::One,_ => return Err(()),})})(input)
alt((value(Level::One, tag("#")),value(Level::Two, tag("##")),value(Level::Three, tag("###")),))(input)
pub fn heading(input: &str) -> IResult<&str, Doc> {map(terminated(pair(level, not_line_ending), line_ending),|(lvl, s)| Doc::Heading(lvl, s.to_string()),
fn heading(input: &str) -> IResult<&str, Doc> {context("gemtext heading line",map(terminated(pair(level, not_line_ending), line_ending),|(lvl, s)| Doc::Heading(lvl, s.to_string()),),
pub fn list_item(input: &str) -> IResult<&str, Doc> {todo!()
fn list_item(input: &str) -> IResult<&str, Doc> {context("gemtex list item line",map(terminated(preceded(tag("*"), not_line_ending), line_ending),|s: &str| Doc::ListItem(s.to_string()),),)(input)
pub fn preformatted(input: &str) -> IResult<&str, Doc> {todo!()
fn preformatted(input: &str) -> IResult<&str, Doc> {context("gemtext preformatted block",map(terminated(pair(terminated(preceded(tag("```"), opt(not_line_ending)), line_ending),take_until("\n```"),),pair(line_ending, tag("```")),),|(alt, text): (Option<&str>, &str)| Doc::Preformatted {alt: alt.map(|s| s.to_string()),text: text.to_string(),},),)(input)
pub use parse::document as parse_gemtext;