KaTeX to MathJax

by Darko Pejakovic
favorite
share
0.0
(0)
5
4
3
2
1
Score: 55/100
Description
Category: Coding & Technical Tools

The KaTeX to MathJax plugin streamlines the integration of mathematical expressions into Obsidian by converting KaTeX notation to MathJax format. This is particularly useful for users who copy mathematical content from platforms like ChatGPT, which often use KaTeX. The plugin features automatic conversion upon pasting, ensuring that your notes maintain proper formatting without extra effort. Additionally, users can manually convert text within individual notes or across the entire vault using the command palette. This functionality enhances the usability of mathematical expressions in your notes, making it easier to work with complex equations and maintain a polished appearance in your documents.

Reviews
No reviews yet.
Stats
24
stars
4,566
downloads
3
forks
361
days
64
days
63
days
2
total PRs
0
open PRs
1
closed PRs
1
merged PRs
8
total issues
0
open issues
8
closed issues
12
commits
Latest Version
2 months ago
Changelog

Changelog – KaTeX → MathJax Converter Plugin

Fixes

  • Prevent inline $…$ wrapping inside display $$…$$ blocks

    • Re-ordered processing in processMath:
    1. Wrap math-dominant lines (wrapBareMathLinesOutside) first.
    2. Only then apply inline conversions (convertInlineDelims, wrapInlineBareLatex) outside display spans.
    • Added guard in isMathLine to skip any line that already contains a $.

Features

  • New settings toggles in the settings tab:

    • Plain parentheses ( … ) as delimiters → converts (x^2+1)$x^2+1$ when LaTeX-like.

    • Plain brackets [ … ] as delimiters → same logic for [a,b].

    • Convert bare inline LaTeX → detects and wraps tokens like:

    • 90^\circ$90^{\circ}$

    • \sqrt{…}$\sqrt{…}$

    • \frac{…}{…}$\frac{…}{…}$

    • simple subscripts/superscripts like x_i, y^2.

    • Wrap single math lines → isolated equations like a^2 + b^2 = c^2 become:

    $$
    a^2 + b^2 = c^2
    $$
    • Wrap matrix/align environments → wraps bare \begin{bmatrix} … \end{bmatrix} into display math.

Enhancements

  • Comprehensive LaTeX-like detector (isLatexLike)
    Expanded to cover:

    • Greek letters
    • Calculus operators (\partial, \nabla, \sum, \int)
    • Vector/matrix environments
    • Common functions (sin, cos, log, exp, etc.)
    • Unicode math symbols (≤, ≥, ∞, ∇, etc.)
  • Better guards for parentheses/brackets

    • Avoids converting (a) list markers or [link](url) syntax.
    • Uses local context (contextIsMathy) to only treat (n) etc. as math in math-heavy prose.
README file from