diff options
Diffstat (limited to 'code/src/markdown/render.rs')
-rw-r--r-- | code/src/markdown/render.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/code/src/markdown/render.rs b/code/src/markdown/render.rs index f6b7686..7962561 100644 --- a/code/src/markdown/render.rs +++ b/code/src/markdown/render.rs @@ -34,11 +34,11 @@ pub fn blocks_to_html(blocks: Vec<Block>) -> String { Block::Paragraph(p) => format!("<p>{}</p>", span_to_html(p)), Block::Blockquote(q) => format!("<quote>{}</quote>", blocks_to_html(q)), Block::CodeBlock(syntax, content) => { - if let Some(s) = &syntax { - format!("<pre>{}</pre>", syntax_highlight(s, &content)) - } else { - format!("<pre>{}</pre>", escape(&content)) - } + format!( + "<pre>{}</pre>", + syntax_highlight(&syntax.unwrap_or(String::from("")), &content) + .unwrap_or_else(|| escape(&content)) + ) } Block::OrderedList(els) => format!( "<ol>{}</ol>", |