From df5d47322c74d832d1d28d42b80ca3b4a9feb430 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 23 Dec 2023 17:39:14 +0100 Subject: [PATCH] fix: trim descriptions --- src/misc/markdown.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/misc/markdown.rs b/src/misc/markdown.rs index 91af1ef..eb4a6b3 100644 --- a/src/misc/markdown.rs +++ b/src/misc/markdown.rs @@ -219,10 +219,19 @@ pub fn get_metadata<'a>(root: &'a AstNode<'a>, mtype: TypeFileMetadata) -> FileM blog: Some(deserialize_metadata(text)), ..FileMetadata::default() }, - TypeFileMetadata::Contact => FileMetadata { - contact: Some(deserialize_metadata(text)), - ..FileMetadata::default() - }, + TypeFileMetadata::Contact => { + let mut metadata: FileMetadataContact = deserialize_metadata(text); + + // Trim descriptions + if let Some(desc) = &mut metadata.description { + *desc = desc.trim().to_owned(); + } + + FileMetadata { + contact: Some(metadata), + ..FileMetadata::default() + } + } TypeFileMetadata::Portfolio => FileMetadata { portfolio: Some(deserialize_metadata(text)), ..FileMetadata::default()