From 1848ae3cdd9b349d6d5d1e3b9c4d57ddcdfd165f Mon Sep 17 00:00:00 2001 From: yym68686 Date: Thu, 23 Jan 2025 04:00:34 +0800 Subject: [PATCH] Update version to 2.0.1 in manifest.json and enhance LaTeX processing in latex.js - Bumped version number in manifest.json to 2.0.1. - Added support for \boxed command in latex.js to improve LaTeX rendering capabilities. --- manifest.json | 2 +- src/utils/latex.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 6983c10..6921640 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Cerebr", - "version": "2.0.0", + "version": "2.0.1", "description": "Cerebr - 智能AI聊天助手", "content_security_policy": { "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'" diff --git a/src/utils/latex.js b/src/utils/latex.js index e425edd..8b5866b 100644 --- a/src/utils/latex.js +++ b/src/utils/latex.js @@ -4,6 +4,9 @@ export function processMathAndMarkdown(text) { let mathIndex = 0; text = text.replace(/\\\[([a-zA-Z\d]+)\]/g, '[$1]'); + // 处理 \boxed 命令,将其包装在 \[ \] 中 + text = text.replace(/\\boxed\{([^}]+)\}/g, '\\[\\boxed{$1}\\]'); + // 处理 \textsc 命令 text = text.replace(/\\textsc\{([^}]+)\}/g, (match, content) => { return content.toUpperCase();