Skip to content

Commit f6aee59

Browse files
committed
fix: warn on missing included file
1 parent 0c9cba8 commit f6aee59

File tree

1 file changed

+7
-2
lines changed
  • components/markdown/src/codeblock

1 file changed

+7
-2
lines changed

components/markdown/src/codeblock/mod.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,13 @@ impl<'config> CodeBlock<'config> {
137137
pub fn include(&self, base: Option<&PathBuf>) -> Option<String> {
138138
let path = base?.join(self.include.as_ref()?);
139139
let res = read_file(&path);
140-
141-
res.ok()
140+
match res {
141+
Ok(content) => Some(content),
142+
Err(e) => {
143+
eprintln!("Warning: Failed to include {:?}: {}", path, e);
144+
None
145+
}
146+
}
142147
}
143148

144149
pub fn highlight(&mut self, content: &str) -> String {

0 commit comments

Comments
 (0)