diff --git a/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx b/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx index 36ac3e53..e3fadf98 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx @@ -5,9 +5,6 @@ import React, { JSX, useMemo, useState } from 'react' import { marked, MarkedToken, Token } from 'marked' -import katex from 'katex' -import 'katex/dist/katex.min.css' -import dompurify from '../../../../../../../base/browser/dompurify/dompurify.js' import { convertToVscodeLang, detectLanguage } from '../../../../common/helpers/languageHelpers.js' import { BlockCodeApplyWrapper } from './ApplyBlockHoverButtons.js' @@ -36,59 +33,59 @@ function isValidUri(s: string): boolean { // renders contiguous string of latex eg $e^{i\pi}$ const LatexRender = ({ latex }: { latex: string }) => { + return {latex} + // try { + // let formula = latex; + // let displayMode = false; - try { - let formula = latex; - let displayMode = false; + // // Extract the formula from delimiters + // if (latex.startsWith('$') && latex.endsWith('$')) { + // // Check if it's display math $$...$$ + // if (latex.startsWith('$$') && latex.endsWith('$$')) { + // formula = latex.slice(2, -2); + // displayMode = true; + // } else { + // formula = latex.slice(1, -1); + // } + // } else if (latex.startsWith('\\(') && latex.endsWith('\\)')) { + // formula = latex.slice(2, -2); + // } else if (latex.startsWith('\\[') && latex.endsWith('\\]')) { + // formula = latex.slice(2, -2); + // displayMode = true; + // } - // Extract the formula from delimiters - if (latex.startsWith('$') && latex.endsWith('$')) { - // Check if it's display math $$...$$ - if (latex.startsWith('$$') && latex.endsWith('$$')) { - formula = latex.slice(2, -2); - displayMode = true; - } else { - formula = latex.slice(1, -1); - } - } else if (latex.startsWith('\\(') && latex.endsWith('\\)')) { - formula = latex.slice(2, -2); - } else if (latex.startsWith('\\[') && latex.endsWith('\\]')) { - formula = latex.slice(2, -2); - displayMode = true; - } + // // Render LaTeX + // const html = katex.renderToString(formula, { + // displayMode: displayMode, + // throwOnError: false, + // output: 'html' + // }); - // Render LaTeX - const html = katex.renderToString(formula, { - displayMode: displayMode, - throwOnError: false, - output: 'html' - }); + // // Sanitize the HTML output with DOMPurify + // const sanitizedHtml = dompurify.sanitize(html, { + // RETURN_TRUSTED_TYPE: true, + // USE_PROFILES: { html: true, svg: true, mathMl: true } + // }); - // Sanitize the HTML output with DOMPurify - const sanitizedHtml = dompurify.sanitize(html, { - RETURN_TRUSTED_TYPE: true, - USE_PROFILES: { html: true, svg: true, mathMl: true } - }); + // // Add proper styling based on mode + // const className = displayMode + // ? 'katex-block my-2 text-center' + // : 'katex-inline'; - // Add proper styling based on mode - const className = displayMode - ? 'katex-block my-2 text-center' - : 'katex-inline'; + // // Use the ref approach to avoid dangerouslySetInnerHTML + // const mathRef = React.useRef(null); - // Use the ref approach to avoid dangerouslySetInnerHTML - const mathRef = React.useRef(null); + // React.useEffect(() => { + // if (mathRef.current) { + // mathRef.current.innerHTML = sanitizedHtml as unknown as string; + // } + // }, [sanitizedHtml]); - React.useEffect(() => { - if (mathRef.current) { - mathRef.current.innerHTML = sanitizedHtml as unknown as string; - } - }, [sanitizedHtml]); - - return ; - } catch (error) { - console.error('KaTeX rendering error:', error); - return {latex}; - } + // return ; + // } catch (error) { + // console.error('KaTeX rendering error:', error); + // return {latex}; + // } } const Codespan = ({ text, className, onClick }: { text: string, className?: string, onClick?: () => void }) => { diff --git a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx index 91281214..69132cfd 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx @@ -467,7 +467,7 @@ export const VoidInputBox2 = forwardRef(fun rows={1} placeholder={placeholder} /> -
{`idx ${optionIdx}`}
+ {/*
{`idx ${optionIdx}`}
*/} {isMenuOpen && (