pub struct ShFile {
pub frontmatter: Value,
pub content: Vec<u8>,
pub raw_content: Option<Vec<u8>>,
}
Expand description
Shtola’s file representation, with frontmatter included.
Fields§
§frontmatter: Value
The frontmatter.
content: Vec<u8>
The file contents (without frontmatter). UTF-8-encoded.
raw_content: Option<Vec<u8>>
Raw content for anything that can’t be read as UTF-8.
Implementations§
source§impl ShFile
impl ShFile
sourcepub fn empty() -> ShFile
pub fn empty() -> ShFile
Creates an empty ShFile. Useful for deleting files using
HashMap::difference
:
use shtola::{Plugin, RefIR, ShFile, HashMap};
use std::path::PathBuf;
fn plugin() -> Plugin {
Box::new(|mut ir: RefIR| {
ir.files.insert("empty-file.md".into(), ShFile::empty());
})
}