Skip to content

## Feature request: add KaTeX mhchem extension to the Markdown renderer #12561

@vin130901

Description

@vin130901

Before submitting your bug report

Relevant environment info

- OS: Linux x64 (VS Code Server)
- Continue version: 1.2.22
- IDE version: 1.123.0

Description

Summary
The Continue GUI renderer uses KaTeX but does not load the mhchem contrib extension. As a result, \ce{} and \pu{} commands crash the renderer and cause the response to stop rendering mid-output.

Expected behavior
\ce{H2O}, \ce{Fe^{2+}}, and similar chemical equation syntax should render correctly.

Current behavior
Any response containing \ce{...} or \pu{...} causes the KaTeX parser to throw and the entire message block stops rendering.

Proposed fix
Add a single import in the GUI bundle before KaTeX is first used:

import 'katex/contrib/mhchem';

This is the standard way to enable mhchem — it monkey-patches the katex module globally and requires no API changes. The katex package already ships with this contrib file, so no new dependency is needed.

Use case
Users writing chemistry or physics notes (university level) rely on \ce{} for chemical equations. Without mhchem, they are forced to use \mathrm{H_2O} workarounds that produce inferior typesetting — no automatic spacing around arrows, no charge notation, no state symbols.

References

To reproduce

No response

Log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    ide:vscodeRelates specifically to VS Code extensionkind:enhancementIndicates a new feature request, imrovement, or extension

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions