How to disable MathJax in Live Preview

A small plugin can make it happen:

import { StreamLanguage } from "@codemirror/language";
import { Prec } from "@codemirror/state";
import { Plugin } from "obsidian";

export default class DisableMath extends Plugin {
    async onload() {
        this.registerEditorExtension(Prec.high(NoMath()));
    }
}

function NoMath() {
    // @ts-ignore
    const hyperMode = CodeMirror.getMode({}, { name: "hypermd", math: false });
    return StreamLanguage.define(hyperMode as any);
}

This code is written in typescript, you can ask AI to translate it to javascript and make a manifest file.

1 Like