summaryrefslogtreecommitdiff
path: root/docs/src/html.rs
diff options
context:
space:
mode:
Diffstat (limited to 'docs/src/html.rs')
-rw-r--r--docs/src/html.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/docs/src/html.rs b/docs/src/html.rs
index ab140a90..58c8e54c 100644
--- a/docs/src/html.rs
+++ b/docs/src/html.rs
@@ -6,7 +6,7 @@ use heck::{ToKebabCase, ToTitleCase};
use pulldown_cmark as md;
use serde::{Deserialize, Serialize};
use typed_arena::Arena;
-use typst::diag::{FileResult, StrResult};
+use typst::diag::{FileError, FileResult, StrResult};
use typst::foundations::{Bytes, Datetime};
use typst::layout::{Abs, Point, Size};
use typst::syntax::{FileId, Source, VirtualPath};
@@ -463,12 +463,16 @@ impl World for DocWorld {
&FONTS.0
}
- fn main(&self) -> Source {
- self.0.clone()
+ fn main(&self) -> FileId {
+ self.0.id()
}
- fn source(&self, _: FileId) -> FileResult<Source> {
- Ok(self.0.clone())
+ fn source(&self, id: FileId) -> FileResult<Source> {
+ if id == self.0.id() {
+ Ok(self.0.clone())
+ } else {
+ Err(FileError::NotFound(id.vpath().as_rootless_path().into()))
+ }
}
fn file(&self, id: FileId) -> FileResult<Bytes> {