markup: Standardize behavior when external converters are missing

Closes #14222
This commit is contained in:
Joe Mooring
2026-06-08 07:34:21 -07:00
committed by Bjørn Erik Pedersen
parent 1f35beb918
commit 147f605f7d
4 changed files with 35 additions and 23 deletions
+2 -3
View File
@@ -87,9 +87,8 @@ func (a *AsciiDocConverter) Supports(_ identity.Identity) bool {
// GetAsciiDocContent calls asciidoctor as an external helper to convert
// AsciiDoc content to HTML.
func (a *AsciiDocConverter) GetAsciiDocContent(src []byte, ctx converter.DocumentContext) ([]byte, error) {
if ok, err := HasAsciiDoc(); !ok {
a.Cfg.Logger.Errorf("leaving AsciiDoc content unrendered: %s", err.Error())
return src, nil
if !hexec.InPath(asciiDocBinaryName) {
return nil, fmt.Errorf("asciidoctor not found in $PATH, cannot render %q", ctx.DocumentName)
}
args, err := a.ParseArgs(ctx)
+3 -4
View File
@@ -15,6 +15,8 @@
package pandoc
import (
"fmt"
"github.com/gohugoio/hugo/common/hexec"
"github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/identity"
@@ -56,12 +58,9 @@ func (c *pandocConverter) Supports(feature identity.Identity) bool {
// getPandocContent calls pandoc as an external helper to convert pandoc markdown to HTML.
func (c *pandocConverter) getPandocContent(src []byte, ctx converter.DocumentContext) ([]byte, error) {
logger := c.cfg.Logger
binaryName := getPandocBinaryName()
if binaryName == "" {
logger.Println("pandoc not found in $PATH: Please install.\n",
" Leaving pandoc content unrendered.")
return src, nil
return nil, fmt.Errorf("pandoc not found in $PATH, cannot render %q", ctx.DocumentName)
}
args := []string{"--mathjax"}
return internal.ExternallyRenderContent(c.cfg, ctx, src, binaryName, args)
+2 -3
View File
@@ -16,6 +16,7 @@ package rst
import (
"bytes"
"fmt"
"runtime"
"github.com/gohugoio/hugo/common/hexec"
@@ -65,9 +66,7 @@ func (c *rstConverter) getRstContent(src []byte, ctx converter.DocumentContext)
binaryName, binaryPath := getRstBinaryNameAndPath()
if binaryName == "" {
logger.Println("rst2html / rst2html.py not found in $PATH: Please install.\n",
" Leaving reStructuredText content unrendered.")
return src, nil
return nil, fmt.Errorf("rst2html / rst2html.py not found in $PATH, cannot render %q", ctx.DocumentName)
}
logger.Infoln("Rendering", ctx.DocumentName, "with", binaryName, "...")