More improvements to LaTeX fence detection

This commit is contained in:
Tom Moor committed 2024-12-02 22:28:59 -05:00
1 parent 48cae96a56
commit 5d09be4add
2 files changed
+8 -3

No files matched your search

+6 -1
View File
@@ -36,7 +36,12 @@ this is code
});
test("returns true for latex fence", () => {
expect(isMarkdown(`\$\$i\$\$`)).toBe(true);
expect(isMarkdown(`\$i\$`)).toBe(true);
expect(
isMarkdown(`\$0.00
random content
\$1.00`)
).toBe(false);
});
test("returns false for non-closed fence", () => {
+2 -2
View File
@@ -10,8 +10,8 @@ export default function isMarkdown(text: string): boolean {
}
// latex-ish
const latex = text.match(/\$\$/gm);
if (latex && latex.length > 1) {
const latex = text.match(/\$(.+)\$/g);
if (latex && latex.length > 0) {
signals += latex.length;
}