gojekyll
gojekyll copied to clipboard
Implement Math mode
What: Jekyll supports rendering mathematical expressions using KaTeX or MathJax. This allows inline math (e.g., =mc^2$) and display math (e.g., 71942\int_0^\infty e^{-x} dx = 171942) in Markdown files.
Current status: Not implemented. Listed in README.md line 121 as a missing feature.
Implementation notes: The existing comment "This may need a different markdown library" is outdated. Modern approaches include:
- Client-side rendering: Add script tags for KaTeX/MathJax in templates (easiest, no markdown library changes needed)
- Server-side rendering: Use a Go library like
github.com/litao91/goldmark-mathjaxfor goldmark, or add a custom Blackfriday extension - Hybrid approach: Detect math delimiters during markdown processing, protect them from rendering, and add script tags for client-side rendering
Gojekyll currently uses github.com/danog/blackfriday/v2 (see renderers/markdown.go line 11), which doesn't have built-in math support. Options:
- Switch to goldmark with math extension
- Add custom Blackfriday renderer for math blocks
- Use client-side KaTeX/MathJax (simplest for initial implementation)