summaryrefslogtreecommitdiff
path: root/docs/src
diff options
context:
space:
mode:
Diffstat (limited to 'docs/src')
-rw-r--r--docs/src/html.rs5
-rw-r--r--docs/src/lib.rs26
-rw-r--r--docs/src/reference/styling.md2
-rw-r--r--docs/src/tutorial/3-advanced.md6
-rw-r--r--docs/src/tutorial/4-template.md8
5 files changed, 38 insertions, 9 deletions
diff --git a/docs/src/html.rs b/docs/src/html.rs
index 7802ee10..33003349 100644
--- a/docs/src/html.rs
+++ b/docs/src/html.rs
@@ -309,7 +309,10 @@ fn code_block(resolver: &dyn Resolver, lang: &str, text: &str) -> Html {
let world = DocWorld(source);
let mut frames = match typst::compile(&world, &world.0) {
Ok(doc) => doc.pages,
- Err(err) => panic!("failed to compile {text}: {err:?}"),
+ Err(err) => {
+ let msg = &err[0].message;
+ panic!("while trying to compile {text}:\n\nerror: {msg}");
+ }
};
if let Some([x, y, w, h]) = zoom {
diff --git a/docs/src/lib.rs b/docs/src/lib.rs
index c32f9ff9..7ddc1c70 100644
--- a/docs/src/lib.rs
+++ b/docs/src/lib.rs
@@ -745,3 +745,29 @@ const TYPE_ORDER: &[&str] = &[
"selector",
"stroke",
];
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_docs() {
+ provide(&TestResolver);
+ }
+
+ struct TestResolver;
+
+ impl Resolver for TestResolver {
+ fn link(&self, _: &str) -> Option<String> {
+ None
+ }
+
+ fn example(&self, _: Html, _: &[Frame]) -> Html {
+ Html::new(String::new())
+ }
+
+ fn image(&self, _: &str, _: &[u8]) -> String {
+ String::new()
+ }
+ }
+}
diff --git a/docs/src/reference/styling.md b/docs/src/reference/styling.md
index cdc47f29..43585b13 100644
--- a/docs/src/reference/styling.md
+++ b/docs/src/reference/styling.md
@@ -85,8 +85,8 @@ fantasy encyclopedia.
#set heading(numbering: "(I)")
#show heading: it => block[
#set align(center)
- \~ _#it.title;_
#set text(font: "Inria Serif")
+ \~ _#it.body;_
#it.numbers \~
]
diff --git a/docs/src/tutorial/3-advanced.md b/docs/src/tutorial/3-advanced.md
index 0e337d86..3784bc8e 100644
--- a/docs/src/tutorial/3-advanced.md
+++ b/docs/src/tutorial/3-advanced.md
@@ -359,7 +359,7 @@ a way to set any of that, we need to write our own heading show rule.
#show heading: it => block[
#set align(center)
#set text(12pt, weight: "regular")
- #smallcaps(it.title)
+ #smallcaps(it.body)
]
<<< ...
@@ -441,7 +441,7 @@ differentiate between section and subsection headings:
): it => block[
#set align(center)
#set text(12pt, weight: "regular")
- #smallcaps(it.title)
+ #smallcaps(it.body)
]
#show heading.where(
@@ -450,7 +450,7 @@ differentiate between section and subsection headings:
size: 11pt,
weight: "regular",
style: "italic",
- it.title + [.],
+ it.body + [.],
)
>>>
>>> #align(center, text(
diff --git a/docs/src/tutorial/4-template.md b/docs/src/tutorial/4-template.md
index c97ebbc9..47f9dfc6 100644
--- a/docs/src/tutorial/4-template.md
+++ b/docs/src/tutorial/4-template.md
@@ -107,7 +107,7 @@ previous chapter.
>>> text(
>>> 13pt,
>>> weight: "regular",
->>> smallcaps(it.title),
+>>> smallcaps(it.body),
>>> )
>>> ),
>>> )
@@ -118,7 +118,7 @@ previous chapter.
>>> 11pt,
>>> weight: "regular",
>>> style: "italic",
->>> it.title + [.],
+>>> it.body + [.],
>>> )
>>> )
@@ -288,7 +288,7 @@ path of the file after the `{from}` keyword.
>>> text(
>>> 13pt,
>>> weight: "regular",
->>> smallcaps(it.title),
+>>> smallcaps(it.body),
>>> )
>>> ),
>>> )
@@ -299,7 +299,7 @@ path of the file after the `{from}` keyword.
>>> 11pt,
>>> weight: "regular",
>>> style: "italic",
->>> it.title + [.],
+>>> it.body + [.],
>>> )
>>> )
>>>