Skip to content

[BUG] TeX preview leaks definitions #515

@heinrich26

Description

@heinrich26

Description

The preview tooltips are leaking their tex definitions. This becomes a problem in the Excalidraw preview dialog, but also anytime you're writing and deleting a definition again. (The definition will be persistent)

How to reproduce

Work in source-mode, write and delete a definition. Idealy redefine one.

We assume our preamble looks like:

\newcommand\abs[1]{\left\lvert#1\right\rvert}

we will write something like this, without switching to preview mode (Obsidian won't try to render this)

$$ 
\newcommand\abs[1]{\left\lvert\color{red}{#1}\right\rvert} % this is written and deleted before leaving the mathblock
\abs{1-4}
$$

If we were to start a new math environment now, \abs{...} would stil output red text, because it was executed by the preview.

Expected Behavior

The plugin should save and restore the SymbolMaps from MathJax during rendering. (see my changes to prevent this in Excalidraw)
Another way arround this might be to create temporary command maps which are removed after rendering, but I'm not sure if that's possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestupstreamSomething not possible or wrong with mathjax (math), obsidian or codemirror 6 (editor)wontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions