diff --git a/src/main.rs b/src/main.rs index 9b66b93..1af0649 100644 --- a/src/main.rs +++ b/src/main.rs @@ -190,6 +190,17 @@ fn format_code(lang: &str, src: &str) -> Result Result> { + let title = String::from_utf8_lossy(link.title.as_ref()); + let url = String::from_utf8_lossy(link.url.as_ref()); + if title.len() > 0 { + Ok(format!(r#"
{}
{}
"#, url, title, title)) + } + else { + Ok(format!(r#"
"#, url)) + } +} + fn extract_frontmatter(src: &str) -> Result<(Option, String), Box> { if src.starts_with("---\n") { let slice = &src[4..]; @@ -253,11 +264,12 @@ fn format_markdown(src: &str) -> Result = Vec::from(output.into_bytes()); - - *value = NodeValue::HtmlBlock(comrak::nodes::NodeHtmlBlock { - literal: highlighted, - block_type: 0, - }); + *value = NodeValue::HtmlInline(highlighted); + } + else if let NodeValue::Image(ref link) = value { + let html = wrap_image_in_figure(link)?; + let literal: Vec = Vec::from(html.into_bytes()); + *value = NodeValue::HtmlInline(literal); } Ok(()) })?; diff --git a/style/base.scss b/style/base.scss index 9065032..e6a9557 100644 --- a/style/base.scss +++ b/style/base.scss @@ -30,6 +30,7 @@ figure { display: block; text-align: center; overflow-x: auto; + margin: 0 0 1em; img, svg, diff --git a/style/style.scss b/style/style.scss index 885e7f9..bda2090 100644 --- a/style/style.scss +++ b/style/style.scss @@ -3,5 +3,5 @@ @import 'layout'; @import 'toc'; @import 'icons'; -//@import 'darktheme'; +@import 'darktheme'; @import 'print'; \ No newline at end of file