diff --git a/markup/pandoc/integration_test.go b/markup/pandoc/integration_test.go
index 477ba43ba..926af38ad 100644
--- a/markup/pandoc/integration_test.go
+++ b/markup/pandoc/integration_test.go
@@ -60,3 +60,26 @@ func TestConversionWithHeader(t *testing.T) {
b.AssertFileContent("public/p1/index.html", `
testContent
`)
}
+
+func TestConversionWithExtractedToc(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- config.toml --
+-- content/p1.md --
+# title 1
+## title 2
+-- layouts/_default/single.html --
+{{ .TableOfContents }}
+{{ .Content }}
+`
+ b := hugolib.NewIntegrationTestBuilder(
+ hugolib.IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ NeedsOsFS: true,
+ },
+ ).Build()
+
+ b.AssertFileContent("public/p1/index.html", "\ntitle 1
\ntitle 2
")
+}