Skip to content

Conversation

@pwang347
Copy link
Member

@pwang347 pwang347 commented Oct 30, 2025

Follow up for #271590 (comment)

@pwang347 pwang347 requested review from Tyriar and Copilot October 30, 2025 19:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the KaTeX math rendering to use a custom wrapper element (vscode-katex-container) with a data-latex attribute instead of relying on KaTeX's MathML annotation elements for extracting the original LaTeX source.

Key changes:

  • Wraps KaTeX-rendered HTML in a <span class="vscode-katex-container" data-latex="..."> element with the escaped LaTeX source
  • Updates copy and context menu detection logic to use the new wrapper element
  • Adds data-latex to the allowed sanitizer attributes

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

File Description
src/vs/workbench/contrib/markdown/common/markedKatexExtension.ts Wraps KaTeX output in custom container with data-latex attribute; adds HTML attribute escaping function
src/vs/workbench/contrib/markdown/browser/markedKatexSupport.ts Adds data-latex to allowed sanitizer attributes
src/vs/workbench/contrib/chat/browser/chatWidget.ts Updates KaTeX element detection from .katex to .vscode-katex-container
src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.ts Updates KaTeX element selection and LaTeX extraction to use data-latex attribute instead of annotation element

@pwang347 pwang347 marked this pull request as ready for review October 30, 2025 20:18
@vs-code-engineering vs-code-engineering bot added this to the October 2025 milestone Oct 30, 2025
@pwang347 pwang347 requested a review from mjbvz October 30, 2025 21:05
@Tyriar Tyriar removed their request for review October 31, 2025 15:54
@vs-code-engineering
Copy link

vs-code-engineering bot commented Nov 3, 2025

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatWidget.ts

@pwang347 pwang347 merged commit 944cb2a into main Nov 3, 2025
28 checks passed
@pwang347 pwang347 deleted the pawang/katexUpdate branch November 3, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants