Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(maths): add KaTeX support for server-side math rendering#2603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
joshlk wants to merge2 commits intocotes2020:master
base:master
Choose a base branch
Loading
fromjoshlk:katex_support

Conversation

@joshlk
Copy link

Type of change

  • New feature (non-breaking change which adds functionality)

Description

This PR adds support for KaTeX as an alternative math rendering engine to the existing MathJax implementation. Users can now choose between client-side rendering (MathJax) or server-side rendering (KaTeX) for mathematical expressions.

This can improve performance as KaTeX renders math expressions at build time, eliminating the need for client-side JavaScript processing and resulting in faster page loads. The changes maintain full backward compatibility, as it defaults back to MathJax if the user does no config changes.

KaTex does have some LaTeX missing features, such as\label is not supported.

Changes

Configuration

  • Addedmath.engine setting to _config.yml with options:mathjax (default) orkatex
  • Addedjektex configuration block for KaTeX rendering options (cache directory, ignore patterns, macros)
  • Addedjektex ~> 0.1.1 gem dependency to jekyll-theme-chirpy.gemspec

Template Logic

  • Modified js-selector.html to conditionally load MathJax based on engine selection
  • Modified head.html to conditionally load KaTeX CSS when using KaTeX engine
  • Updated asset paths in basic.yml and cors.yml to include KaTeX CSS

Styling

  • Added overflow handling for.katex-display in _base.scss to prevent layout issues with wide equations

Documentation

  • Updated 2019-08-08-write-a-new-post.md with comprehensive documentation on:
    • How to choose between MathJax and KaTeX
    • Comparison of features and trade-offs
    • Configuration examples
    • Known limitations (KaTeX doesn't support\label and\eqref)
  • Simplified math examples in 2019-08-08-text-and-typography.md (removed equation references for KaTeX compatibility)
  • Added feature entry to CHANGELOG.md

Usage

Using MathJax (default, no changes required):

math:engine:# empty or 'mathjax'

Using KaTeX:

math:engine:katexjektex:ignore:["*.xml"]# Process markdown files, ignore feed.xml

Then addjektex to your Gemfile and runbundle install.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@joshlk

[8]ページ先頭

©2009-2025 Movatter.jp