Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>RTL Math FixNew to Visual Studio Code? Get it now.
RTL Math Fix

RTL Math Fix

Maor Gershman

| (0) | Free
Fixes embedded LaTeX math direction inside RTL Markdown previews.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

RTL Math Fix

Minimal VS Code extension for Hebrew or other RTL Markdown documents where embedded LaTeX math renders visually flipped in the built-in Markdown preview.

Features

The extension adds a small status bar toggle only while a Markdown preview is open:

  • RTL Math: OFF leaves previews unchanged.
  • RTL Math: ON injects the bundled CSS override into Markdown previews.

The extension does not require a workspace and does not write to markdown.styles. It uses VS Code's Markdown preview extension API to inject the CSS while rendering the preview.

Usage

  1. Open a Markdown file.
  2. Open the built-in Markdown preview.
  3. Use the RTL Math: ON/OFF status bar item, or run Toggle RTL Math Fix from the Command Palette.

The status bar item is only visible while a Markdown preview tab is open.

Extension Settings

The default state is off. Set this user setting to start with the fix enabled before you use the toggle:

{
  "rtlMathFix.enabled": true
}

The status bar toggle stores its state globally.

What It Changes

When enabled, the extension adds this CSS to Markdown previews:

.katex,
.math,
.mermaid,
mjx-container {
  direction: ltr !important;
  unicode-bidi: isolate !important;
}

.katex-display,
.math-block {
  direction: ltr !important;
  unicode-bidi: isolate !important;
}

Development

  1. Open this folder in VS Code.
  2. Press F5.
  3. In the Extension Development Host, open a Markdown file.
  4. Run Markdown: Open Preview or Markdown: Open Preview to the Side.
  5. Use the RTL Math: ON/OFF status bar item, or run Toggle RTL Math Fix from the Command Palette.

Package a VSIX

Install dependencies and build the package:

npm install
npm run package

This creates a .vsix file that can be installed with:

code --install-extension rtl-math-fix-0.0.1.vsix
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft