diff --git a/bun.lockb b/bun.lockb index deaa93f..8d4fe90 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index c088aa4..84141a8 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ }, "devDependencies": { "@plasmohq/prettier-plugin-sort-imports": "4.0.1", - "@types/chrome": "0.0.259", + "@types/chrome": "^0.0.280", "@types/d3-dsv": "^3.0.7", "@types/html-to-text": "^9.0.4", "@types/node": "20.11.9", diff --git a/src/utils/latex.ts b/src/utils/latex.ts new file mode 100644 index 0000000..690e3e8 --- /dev/null +++ b/src/utils/latex.ts @@ -0,0 +1,19 @@ +export const preprocessLaTeX = (content: string) => { + + let processedContent = content.replace( + /\\\[(.*?)\\\]/gs, + (_, equation) => `$$${equation}$$` + ) + + processedContent = processedContent.replace( + /\\\((.*?)\\\)/gs, + (_, equation) => `$${equation}$` + ) + + processedContent = processedContent.replace( + /\$(\d)/g, + '\\$$1' + ) + + return processedContent +}