Skip to content

Conversation

jmooring
Copy link
Member

@jmooring jmooring commented Jun 20, 2025

Closes #13351

With other render hooks we do something like this:

renderer := ctx.RenderContext().GetRenderer(hooks.BlockquoteRendererType, typ)
if renderer == nil {
return r.renderBlockquoteDefault(w, n, text)
}

where renderBlockquoteDefault is essentially copied from Goldmark's source. The bits that we're copying are short and simple. But the Goldmark source for tables (it's an extension) is neither short nor simple, so we panic instead:

renderer := ctx.RenderContext().GetRenderer(hooks.TableRendererType, nil)
if renderer == nil {
panic("table hook renderer not found")
}

Instead of trying to recreate Goldmark's table extension in a renderTableDefault function, this PR simply registers a copy of the embedded table render hook for all output formats.

@jmooring jmooring force-pushed the table-render-hook-not-found branch from 1eb35f8 to ec9075f Compare June 20, 2025 19:23
@bep bep merged commit 18a9ca7 into gohugoio:master Jun 21, 2025
11 of 14 checks passed
@jmooring jmooring deleted the table-render-hook-not-found branch June 21, 2025 13:28
jmooring added a commit to jmooring/hugo-testing that referenced this pull request Jun 23, 2025
jmooring added a commit to jmooring/hugo-module-backlinks that referenced this pull request Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic: table hook renderer not found
2 participants