gojekyll icon indicating copy to clipboard operation
gojekyll copied to clipboard

Implement Math mode

Open osteele opened this issue 8 years ago • 0 comments

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:

  1. Client-side rendering: Add script tags for KaTeX/MathJax in templates (easiest, no markdown library changes needed)
  2. Server-side rendering: Use a Go library like github.com/litao91/goldmark-mathjax for goldmark, or add a custom Blackfriday extension
  3. 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)

osteele avatar Jul 09 '17 22:07 osteele