Skip to content

Math Equations Not Rendering Correctly After Saving and Displaying SunEditor Content with KaTeX #1573

@Jestin494

Description

@Jestin494

Describe the bug
Math equations entered in the SunEditor using the KaTeX library (such as parentheses for matrices and square root signs) are not visible or rendered correctly after saving and displaying the content. Instead, raw LaTeX code or incomplete formatting appears, making the equations unreadable.

To Reproduce
Steps to reproduce the behavior:

Open the SunEditor with KaTeX enabled.

Enter a math equation using KaTeX syntax (e.g., matrices with parentheses, square roots).

Save the content and parse it to display elsewhere in the application (outside the editor).

Observe that the equation renders incorrectly or is invisible—only raw LaTeX or broken formatting shows.

Expected behavior
Math equations should be fully rendered and visually correct when displayed after saving, showing proper parentheses, square roots, and other math symbols as intended by KaTeX.

Screenshots:
In the editor

Image

After displaying:

Image

Editor view shows correct rendering of math equations.

Parsed/display view shows broken or missing parts of equations (parentheses missing or raw LaTeX code visible).

Desktop :

OS: Windows 10

Browser: Chrome

Version: 115.0

Smartphone :

Device: N/A (issue occurs primarily on desktop)

OS: N/A

Browser: N/A

Version: N/A

Additional context:

KaTeX CSS and JS files are correctly loaded globally in the application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions