feat(bot,frontend,backend): add integration with external collaborative solver

This commit is contained in:
h
2026-05-04 12:20:40 +02:00
parent 8379929372
commit a99a80f6c9
23 changed files with 1115 additions and 36 deletions
+19
View File
@@ -0,0 +1,19 @@
import { Marked } from 'marked';
const marked = new Marked({ breaks: true, gfm: true });
export function processLatex(text: string): string {
return text
.replace(/\$\$(.*?)\$\$/gs, (_, tex) => {
const encoded = encodeURIComponent(tex.trim());
return `<img src="/service/latex?tex=${encoded}&display=1" alt="LaTeX" class="block my-1 max-h-12" />`;
})
.replace(/\$(.+?)\$/g, (_, tex) => {
const encoded = encodeURIComponent(tex.trim());
return `<img src="/service/latex?tex=${encoded}" alt="LaTeX" class="inline-block align-middle max-h-4" />`;
});
}
export function processContent(text: string): string {
return marked.parse(processLatex(text)) as string;
}