diff --git a/src/lib.rs b/src/lib.rs index 479d80a..fbd8b46 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -370,8 +370,19 @@ where }?; formatter.write_char(' ') } - BlockQuote(None) => { - state.padding.push(" > ".into()); + BlockQuote(kind) => { + if let Some(kind) = kind { + let kind = match kind { + BlockQuoteKind::Note => "NOTE", + BlockQuoteKind::Tip => "TIP", + BlockQuoteKind::Important => "IMPORTANT", + BlockQuoteKind::Warning => "WARNING", + BlockQuoteKind::Caution => "CAUTION", + }; + state.padding.push(format!(" > [!{kind}]\n > ").into()); + } else { + state.padding.push(" > ".into()); + } state.newlines_before_start = 1; // if we consumed some newlines, we know that we can just write out the next @@ -383,24 +394,6 @@ where formatter.write_char('\n').and(padding(formatter, &state.padding)) } } - BlockQuote(Some(kind)) => { - let kind = match kind { - BlockQuoteKind::Note => "NOTE", - BlockQuoteKind::Tip => "TIP", - BlockQuoteKind::Important => "IMPORTANT", - BlockQuoteKind::Warning => "WARNING", - BlockQuoteKind::Caution => "CAUTION", - }; - state.padding.push(format!(" > [!{kind}]\n > ").into()); - state.newlines_before_start = 1; - - // same logic as traditional blockquote, see above - if consumed_newlines { - formatter.write_str(" > ") - } else { - formatter.write_char('\n').and(padding(formatter, &state.padding)) - } - } CodeBlock(CodeBlockKind::Indented) => { state.is_in_code_block = true; for _ in 0..options.code_block_token_count {