We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a43dd2c commit 4978a9aCopy full SHA for 4978a9a
mdbook-tera-backend/src/tera_renderer/renderer.rs
@@ -62,8 +62,9 @@ impl Renderer {
62
/// `path`: The path to the file that will be added as extra context to the renderer.
63
fn create_context(&mut self, path: &Path) -> Result<tera::Context> {
64
let mut context = tera::Context::new();
65
- context.insert("path", path);
66
- context.insert("ctx", &serde_json::to_value(&self.ctx)?);
+ let book_dir = self.ctx.destination.parent().unwrap();
+ let relative_path = path.strip_prefix(&book_dir).unwrap();
67
+ context.insert("path", &path);
68
context.insert("book_dir", &self.ctx.destination.parent().unwrap());
69
70
Ok(context)
0 commit comments