summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalo <57839069+MDLC01@users.noreply.github.com>2025-02-25 15:09:52 +0100
committerGitHub <noreply@github.com>2025-02-25 14:09:52 +0000
commit2eef9e84e117670ea0db964a5a8addc89e0ee785 (patch)
tree2cb773fbd67860cbca584bcd37476ad7be5ac007
parentd11ad80dee669c5e2285ca8df8ebc99abc031ccd (diff)
Improve hints for show rule recursion depth (#5856)
-rw-r--r--crates/typst-library/src/engine.rs3
-rw-r--r--tests/suite/scripting/recursion.typ9
2 files changed, 8 insertions, 4 deletions
diff --git a/crates/typst-library/src/engine.rs b/crates/typst-library/src/engine.rs
index 80aaef22..43a7b467 100644
--- a/crates/typst-library/src/engine.rs
+++ b/crates/typst-library/src/engine.rs
@@ -312,7 +312,8 @@ impl Route<'_> {
if !self.within(Route::MAX_SHOW_RULE_DEPTH) {
bail!(
"maximum show rule depth exceeded";
- hint: "check whether the show rule matches its own output"
+ hint: "maybe a show rule matches its own output";
+ hint: "maybe there are too deeply nested elements"
);
}
Ok(())
diff --git a/tests/suite/scripting/recursion.typ b/tests/suite/scripting/recursion.typ
index 6be96c1e..e92b67fb 100644
--- a/tests/suite/scripting/recursion.typ
+++ b/tests/suite/scripting/recursion.typ
@@ -44,18 +44,21 @@
--- recursion-via-include-in-layout ---
// Test cyclic imports during layout.
// Error: 2-38 maximum show rule depth exceeded
-// Hint: 2-38 check whether the show rule matches its own output
+// Hint: 2-38 maybe a show rule matches its own output
+// Hint: 2-38 maybe there are too deeply nested elements
#layout(_ => include "recursion.typ")
--- recursion-show-math ---
// Test recursive show rules.
// Error: 22-25 maximum show rule depth exceeded
-// Hint: 22-25 check whether the show rule matches its own output
+// Hint: 22-25 maybe a show rule matches its own output
+// Hint: 22-25 maybe there are too deeply nested elements
#show math.equation: $x$
$ x $
--- recursion-show-math-realize ---
// Error: 22-33 maximum show rule depth exceeded
-// Hint: 22-33 check whether the show rule matches its own output
+// Hint: 22-33 maybe a show rule matches its own output
+// Hint: 22-33 maybe there are too deeply nested elements
#show heading: it => heading[it]
$ #heading[hi] $