Skip to content

Commit 4fe7b36

Browse files
committed
fix(markdown): gestion du Latex bloc multilignes
1 parent 1372bc2 commit 4fe7b36

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

app/js/markdown/latex.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ import { yaml } from "./custom/yaml.mjs";
22

33
export function convertLatexExpressions(string, noBackticks) {
44
string = string
5-
.replace(/\$\$(.*?)\$\$/g, "\[$1\]")
5+
.replace(/\$\$(.*?)\$\$/gs, function (_, latexContent) {
6+
latexContent = latexContent
7+
.replace(/<\/?p>/g, "")
8+
.replace(/<\/?pre>/g, "")
9+
.replace(/<\/?code>/g, "")
10+
.replace(/\n/g, " ");
11+
return "&#92;[" + latexContent + "&#92;]";
12+
})
613
.replace(/\$(.*?)\$/g, "&#92;($1&#92;)");
714
let expressionsLatex = string.match(
815
new RegExp(/&#92;\[.*?&#92;\]|&#92;\(.*?&#92;\)/g),

app/script.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/script.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)