MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / italic

Function italic

crates/chat-cli/src/cli/chat/parse.rs:354–381  ·  view source on GitHub ↗
(
    mut o: impl Write + 'b,
    state: &'b mut ParseState,
)

Source from the content-addressed store, hash-verified

352}
353
354fn italic<'a, 'b>(
355 mut o: impl Write + 'b,
356 state: &'b mut ParseState,
357) -> impl FnMut(&mut Partial<&'a str>) -> PResult<(), Error<'a>> + 'b {
358 move |i| {
359 match state.newline {
360 true => {
361 alt(("*", "_")).parse_next(i)?;
362 queue(&mut o, style::SetAttribute(Attribute::Italic))?;
363 },
364 false => match state.italic {
365 true => {
366 alt(("*", "_")).parse_next(i)?;
367 queue(&mut o, style::SetAttribute(Attribute::NoItalic))?;
368 },
369 false => {
370 preceded(space1, alt(("*", "_"))).parse_next(i)?;
371 queue(&mut o, style::Print(' '))?;
372 queue(&mut o, style::SetAttribute(Attribute::Italic))?;
373 },
374 },
375 };
376
377 state.italic = !state.italic;
378
379 Ok(())
380 }
381}
382
383fn strikethrough<'a, 'b>(
384 mut o: impl Write + 'b,

Callers

nothing calls this directly

Calls 1

queueFunction · 0.85

Tested by

no test coverage detected