Skip to content

feat: Support passthrough render hooks for mathematics - #1036

Open
dataCenter430 wants to merge 1 commit into
dillonzq:masterfrom
dataCenter430:support-passthrough-render-hooks-for-mathematics
Open

feat: Support passthrough render hooks for mathematics#1036
dataCenter430 wants to merge 1 commit into
dillonzq:masterfrom
dataCenter430:support-passthrough-render-hooks-for-mathematics

Conversation

@dataCenter430

Copy link
Copy Markdown
Contributor

Description

Implements passthrough render hooks for mathematics so that LaTeX in Markdown is rendered server-side with Hugo's transform.ToMath (KaTeX) instead of client-side JavaScript.

Closes #1021

Changes

  • layouts/_markup/render-passthrough.html (new): Passthrough render hook that renders \[...\], $$...$$, and \(...\) using transform.ToMath with htmlAndMathml output and sets Page.Store "hasMath" so the theme can load KaTeX CSS only when needed.
  • layouts/_partials/assets.html: When a page has server-rendered math (.Store.Get "hasMath") but client-side math is disabled, load only KaTeX CSS (and publish fonts) so the pre-rendered math displays correctly without loading KaTeX JS or auto-render.
  • hugo.toml: Enable Goldmark passthrough extension with standard math delimiters:
    • Block: \[...\], $$...$$
    • Inline: \(...\)

Requirements

  • Hugo 0.132.0+ for passthrough render hooks and transform.ToMath. The theme's minimum version remains 0.128.0; sites on 0.128–0.131 will keep existing behavior (passthrough content may appear as raw text if they enable the extension).

@netlify

netlify Bot commented Mar 11, 2026

Copy link
Copy Markdown

Deploy Preview for hugo-loveit ready!

Name Link
🔨 Latest commit 77acc97
🔍 Latest deploy log https://app.netlify.com/projects/hugo-loveit/deploys/69b1b787223e170008bfb11e
😎 Deploy Preview https://deploy-preview-1036--hugo-loveit.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 97
Accessibility: 98
Best Practices: 100
SEO: 82
PWA: 78
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@dataCenter430

dataCenter430 commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

Hi, @dillonzq
Sorry to bother you, I know you're so busy.
I implemented it properly as you wanted.
Could you please review the PR when you have a chance?
I'm happy to contribute to LoveIt.
Best regards

@dataCenter430

Copy link
Copy Markdown
Contributor Author

Hi, @dillonzq
Could you please review the PR when you have a moment?
Thank you

@dataCenter430

Copy link
Copy Markdown
Contributor Author

Hi, @dillonzq how are you doing?
Would you please review my second contribution? 🙂
I really appreciate your review with this.

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.

[FEATURE] Support passthrough render hooks for mathematics

1 participant