diff --git a/markup/pandoc/convert.go b/markup/pandoc/convert.go index 16c77d636..522307ee8 100644 --- a/markup/pandoc/convert.go +++ b/markup/pandoc/convert.go @@ -62,7 +62,7 @@ func (c *pandocConverter) getPandocContent(src []byte, ctx converter.DocumentCon if binaryName == "" { return nil, fmt.Errorf("pandoc not found in $PATH, cannot render %q", ctx.DocumentName) } - args := []string{"--mathjax"} + args := []string{"--mathjax", "--citeproc"} return internal.ExternallyRenderContent(c.cfg, ctx, src, binaryName, args) } diff --git a/markup/pandoc/convert_integration_test.go b/markup/pandoc/convert_integration_test.go new file mode 100644 index 000000000..47f1f1e95 --- /dev/null +++ b/markup/pandoc/convert_integration_test.go @@ -0,0 +1,97 @@ +// Copyright 2026 The Hugo Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package pandoc_test + +import ( + "testing" + + "github.com/gohugoio/hugo/hugolib" + "github.com/gohugoio/hugo/markup/pandoc" +) + +// See issue 15062. +func TestBibliographySupport(t *testing.T) { + if !pandoc.Supports() { + t.Skip("pandoc not installed") + } + t.Parallel() + + files := ` +-- hugo.toml -- +disableKinds = ['home','rss','section','sitemap','taxonomy','term'] +[security.exec] +allow = ['pandoc'] +-- layouts/page.html -- +{{ .Content }} +-- content/p1.pdc -- +--- +title: home +--- + +--- +bibliography: testdata/foo.bib +citation-style: testdata/ieee.csl +link-citations: true +references: +- type: article-journal + id: WatsonCrick1953 + author: + - family: Watson + given: J. D. + - family: Crick + given: F. H. C. + issued: + date-parts: + - - 1953 + - 4 + - 25 + title: 'Molecular structure of nucleic acids: a structure for deoxyribose nucleic acid' + title-short: Molecular structure of nucleic acids + container-title: Nature + volume: 171 + issue: 4356 + page: 737-738 + DOI: 10.1038/171737a0 +--- + +This is a citation: @einstein1905physics + +This is another citation: [@WatsonCrick1953, p. 33] +` + + b := hugolib.Test(t, files) + + b.AssertFileContent("public/p1/index.html", + `
This is a citation: [1]
+This is another citation: [2, p. 33]
+