summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeedehai <18319900+Leedehai@users.noreply.github.com>2024-08-05 06:04:35 -0400
committerGitHub <noreply@github.com>2024-08-05 10:04:35 +0000
commit1f8128111825410fdfcea056448fb37fe92a589e (patch)
tree34693f7fe3b3565d2acf93aeae21c03513b9b134
parentd06a26e3d868a5e80686f692fba8e5bbd5104922 (diff)
Fix the show rule effect for bibliography heading level (#4622)
-rw-r--r--crates/typst/src/model/bibliography.rs2
-rw-r--r--tests/ref/issue-4618-bibliography-set-heading-level.pngbin0 -> 5227 bytes
-rw-r--r--tests/suite/model/bibliography.typ13
3 files changed, 14 insertions, 1 deletions
diff --git a/crates/typst/src/model/bibliography.rs b/crates/typst/src/model/bibliography.rs
index ed593d45..71616616 100644
--- a/crates/typst/src/model/bibliography.rs
+++ b/crates/typst/src/model/bibliography.rs
@@ -217,7 +217,7 @@ impl Show for Packed<BibliographyElem> {
}) {
seq.push(
HeadingElem::new(title)
- .with_level(Smart::Custom(NonZeroUsize::ONE))
+ .with_depth(NonZeroUsize::ONE)
.pack()
.spanned(self.span()),
);
diff --git a/tests/ref/issue-4618-bibliography-set-heading-level.png b/tests/ref/issue-4618-bibliography-set-heading-level.png
new file mode 100644
index 00000000..29a4e517
--- /dev/null
+++ b/tests/ref/issue-4618-bibliography-set-heading-level.png
Binary files differ
diff --git a/tests/suite/model/bibliography.typ b/tests/suite/model/bibliography.typ
index 7197082f..18c62620 100644
--- a/tests/suite/model/bibliography.typ
+++ b/tests/suite/model/bibliography.typ
@@ -53,3 +53,16 @@ Now we have multiple bibliographies containing @glacier-melt @keshav2007read
@Zee04
#bibliography("/assets/bib/works_too.bib", style: "mla")
+
+--- issue-4618-bibliography-set-heading-level ---
+// Test that the bibliography block's heading is set to 2 by the show rule,
+// and therefore should be rendered like a level-2 heading. Notably, this
+// bibliography heading should not be underlined.
+#show heading.where(level: 1): it => [ #underline(it.body) ]
+#show bibliography: set heading(level: 2)
+
+= Level 1
+== Level 2
+@Zee04
+
+#bibliography("/assets/bib/works_too.bib")