-
-
Notifications
You must be signed in to change notification settings - Fork 355
Description
Description
When using KaTeX in regular Markdown (e.g., inside <p>), both inline \( ... \) and display $$ ... $$ math render correctly.
However, when placing KaTeX expressions inside certain shortcodes such as callout, the formulas are rendered twice:
- once as the properly formatted KaTeX output,
- once as raw LaTeX text.
This results in duplicated math content inside the shortcode blocks.
Steps To Reproduce
Enable KaTeX rendering in the theme.
Create a page with the following content:
Normal paragraph inline math: \(a^2 + b^2 = c^2\).
{{< callout type="info" >}}
Inside callout inline math: \(a^2 + b^2 = c^2\).
{{< /callout >}}
Build and open the site in the browser.
Expected Behavior
Math formulas inside shortcodes should render the same as in normal Markdown paragraphs: only once, using KaTeX formatting.
Actual Behavior
Math formulas inside shortcodes are displayed twice: once as formatted KaTeX output, and again as the raw LaTeX text.
Screenshots
Environment
- Hugo Version: v0.150.0
- Theme Version: v0.11.1
Additional Context
This issue does not occur outside of shortcodes. It seems related to how shortcode templates (e.g., callout.html, details.html) handle inner content combined with KaTeX auto-render or SSR math rendering. Possibly the shortcode outputs both raw content and rendered content, leading to duplication.