microsoft / BotFramework-WebChat

A highly-customizable web-based client for Azure Bot Services.
https://www.botframework.com/
MIT License
1.6k stars 1.55k forks source link

feat: switch to TeX style math blocks #5353

Closed OEvgeny closed 1 week ago

OEvgeny commented 1 week ago

Fixes #

Changelog Entry

Changed

Description

This PR enhances mathematical expression support in Web Chat by switching to TeX-style delimiters and introducing robust error handling.

Design

The implementation uses (\[ \] delimiters for block math, \( \) delimiters for inline) with a custom tokenizer and HTML renderer. Block math is rendered in figure tags while inline math uses span tags. Invalid expressions fall back to pre or code tags with an error state, allowing to apply styling if desired. The system uses Katex for rendering with MathML output and includes distinct styling for block and inline displays.

Specific Changes

-

Review Checklist