use file struct
This commit is contained in:
parent
2dd4995479
commit
708b48d45b
1 changed files with 11 additions and 5 deletions
|
@ -54,7 +54,13 @@ pub struct Metadata {
|
|||
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
|
||||
let mut text = std::fs::read_to_string(filename).unwrap();
|
||||
|
||||
|
@ -106,12 +112,12 @@ pub fn read_md(filename: &str) -> (Metadata, String) {
|
|||
_ => false,
|
||||
});
|
||||
|
||||
(
|
||||
Metadata {
|
||||
File {
|
||||
metadata: Metadata {
|
||||
info: metadata,
|
||||
mermaid: presence_mermaid,
|
||||
syntax_highlight: presence_code,
|
||||
},
|
||||
html,
|
||||
)
|
||||
data: html,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue