diff --git a/src/html.rs b/src/html.rs index 5b5aaf9..cbefb10 100644 --- a/src/html.rs +++ b/src/html.rs @@ -267,12 +267,12 @@ impl<'s> Writer<'s> { write!(out, r#" style="text-align: {};">"#, a)?; } Container::CodeBlock { language } => { - if let Some(l) = language { - out.write_str(r#">"#)?; - } else { + if language.is_empty() { out.write_str(">")?; + } else { + out.write_str(r#">"#)?; } } Container::Image(..) => { diff --git a/src/lib.rs b/src/lib.rs index f3795c6..81142c3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -290,7 +290,7 @@ pub enum Container<'s> { /// A block with raw markup for a specific output format. RawBlock { format: &'s str }, /// A block with code in a specific language. - CodeBlock { language: Option<&'s str> }, + CodeBlock { language: &'s str }, /// An inline divider element. Span, /// An inline link, the first field is either a destination URL or an unresolved tag. @@ -902,9 +902,7 @@ impl<'s> Parser<'s> { if let Some(format) = content.strip_prefix('=') { Container::RawBlock { format } } else { - Container::CodeBlock { - language: (!content.is_empty()).then(|| content), - } + Container::CodeBlock { language: content } } } block::Leaf::TableCell(alignment) => Container::TableCell {