| fix(web): make copilot math survive streaming, lists and RTL Five things the plain plugin wiring got wrong: - The model does not always use dollar delimiters. \( \) and \[ \] reached the reader as literal text with the backslashes stripped, so rewrite them before parsing — on one line when the formula sits inside a list item, table cell or blockquote, since a blank line would close the block it belongs to. - A display fence is only half-written while the answer streams. Left open, it swallows every chunk after it and paints the rest of the message as one parse error, so hold the equation back until it closes. - copilot.tsx is reachable from the org menu, which put KaTeX and its stylesheet in the bundle of every page. Load them on demand the first time a message actually contains math. - KaTeX positions its atoms as inline-blocks and sets no direction of its own, so an RTL page rendered equations backwards. Lock it the same way the editor's math block does. - Every streamed chunk re-rendered the whole transcript, re-parsing finished answers. Memoise the assistant message and give it a stable empty sources array. Long display math now scrolls inside the bubble instead of widening it. | 1 个月前 |