Clean up.

This commit is contained in:
Olivia Brooks
2025-10-15 12:41:44 -04:00
parent 90ceb2124e
commit eb0237792c

View File

@@ -4,7 +4,12 @@ use std::path::Path;
use image::ImageReader;
use markdown;
pub fn to_webp(path: &Path) -> Result<(), Box<dyn std::error::Error>> {
pub fn to_webp<P>(path: P) -> Result<(), Box<dyn std::error::Error>>
where
P: AsRef<Path>,
{
let path = path.as_ref();
ImageReader::open(path)?.decode()?.save(format!(
"{}.webp",
path.file_stem().unwrap().to_str().unwrap()
@@ -13,7 +18,10 @@ pub fn to_webp(path: &Path) -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}
pub fn md_to_html(path: &Path) -> Result<String, markdown::message::Message> {
pub fn md_to_html<P>(path: P) -> Result<String, markdown::message::Message>
where
P: AsRef<Path>,
{
let mut buf = String::new();
// Loading and Converting post.md to html