Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A Jekyll plugin for fast server-side cached LaTeX rendering using KaTeX, with macro support and no client-side JavaScript.
Jektex is a Jekyll plugin that renders LaTeX math server-side during site generation using KaTeX, producing static HTML pages with zero client-side JavaScript. It runs as a Ruby gem and works with Jekyll's native Markdown pipeline, automatically converting inline and display formulas written in either Kramdown's dollar-sign notation or LaTeX's escaped-bracket notation.
Jektex is a RubyGem-installed plugin for the Jekyll static site generator that processes LaTeX expressions at build time and outputs pre-rendered HTML plus MathML. It takes Markdown source files containing formulas in two supported notations — kramdown's $$...$$ and LaTeX's \(...\) / \[...\] — and uses KaTeX to produce server-side output, so visitors never download a JavaScript math engine. The project is endorsed by KaTeX.org and maintained by yagarea on GitHub, with the source hosted at github.com/yagarea/jektex.
$$ inline/display convention and the LaTeX-only \( \) / \[ \] syntax, including formulas inside raw HTML blocks that kramdown skips._config.yml (e.g., \Q for \mathbb{Q}) and even macros with parameters that simulate \newcommand behavior..jekyll-cache by default, with configurable cache_dir; changing any KaTeX option invalidates the cache so stale output is never served.katex_options key, including trust, output, maxExpand, and strict; invalid values fall back to KaTeX's defaults.*.xml, _drafts/*), or disable per-post via jektex: false in front matter.\Q for rationals) and render complex display equations with \[ \] blocks.$$ convention and get pre-rendered math that appears instantly on page load._config.yml and reuse them across hundreds of pages without repeating definitions.ignore option to skip XML files so excerpts containing LaTeX don't break feed readers, while posts still render fully on the site.Jektex hooks into Jekyll's render pipeline and runs after the kramdown converter. It scans the generated HTML for leftover $$ formulas (and, if enabled, the \(\) / \[\] forms), calls KaTeX to render them server-side, and caches each result on disk. On subsequent builds, cached expressions are reused unless a KaTeX option or macro changes, which triggers a one-time full re-render.
Yes. Jektex is released as an open-source RubyGem on rubygems.org under a standard open-source license. You install it with gem install jektex or through Bundler in your Jekyll project's Gemfile.
No. All LaTeX is rendered to HTML and MathML at build time. The only extra asset you need is KaTeX's stylesheet, which you can either load from a CDN or host locally; visitors do not run any JavaScript for math display.
It supports two notations: kramdown's built-in $$ for both inline and display formulas, and the newer LaTeX-only \( \) for inline and \[ \] for display. A formula standing alone on a line renders in display mode, while one inside text flow renders inline.
The invalid expression is left in the document and its location is printed during rendering, so you can identify the problematic formula in your source. This behavior is controlled by KaTeX's throwOnError, which Jektex manages.
