diff --git a/crates/typst/src/model/bibliography.rs b/crates/typst/src/model/bibliography.rs index ed593d45c..71616616c 100644 --- a/crates/typst/src/model/bibliography.rs +++ b/crates/typst/src/model/bibliography.rs @@ -217,7 +217,7 @@ impl Show for Packed { }) { 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 000000000..29a4e5174 Binary files /dev/null and b/tests/ref/issue-4618-bibliography-set-heading-level.png differ diff --git a/tests/suite/model/bibliography.typ b/tests/suite/model/bibliography.typ index 7197082fb..18c626200 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")