use file struct

This commit is contained in:
Mylloon 2023-04-11 01:53:02 +02:00
parent 2dd4995479
commit 708b48d45b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -54,7 +54,13 @@ pub struct Metadata {
pub syntax_highlight: bool, pub syntax_highlight: bool,
} }
pub fn read_md(filename: &str) -> (Metadata, String) { #[derive(Content)]
pub struct File {
pub metadata: Metadata,
pub data: String,
}
pub fn read_md(filename: &str) -> File {
// Read markdown file // Read markdown file
let mut text = std::fs::read_to_string(filename).unwrap(); let mut text = std::fs::read_to_string(filename).unwrap();
@ -106,12 +112,12 @@ pub fn read_md(filename: &str) -> (Metadata, String) {
_ => false, _ => false,
}); });
( File {
Metadata { metadata: Metadata {
info: metadata, info: metadata,
mermaid: presence_mermaid, mermaid: presence_mermaid,
syntax_highlight: presence_code, syntax_highlight: presence_code,
}, },
html, data: html,
) }
} }