petites erreurs
This commit is contained in:
@ -271,41 +271,9 @@ async loadHelpRemaining() {
|
||||
|
||||
// NOUVELLE MÉTHODE : Formater le texte avec support maths
|
||||
formatMathText(texte) {
|
||||
// Convertir les retours à la ligne en <br>
|
||||
let html = texte.replace(/\n/g, '<br>');
|
||||
|
||||
// Détecter et convertir les fractions communes
|
||||
// 1/2 → $\frac{1}{2}$
|
||||
html = html.replace(/(\d+)\/(\d+)/g, '$\\frac{$1}{$2}$');
|
||||
|
||||
// Convertir les puissances
|
||||
// x^2 → $x^2$
|
||||
html = html.replace(/([a-z0-9]+)\^([0-9]+)/gi, '$$$1^{$2}$$');
|
||||
|
||||
// Convertir les indices
|
||||
// x_1 → $x_1$
|
||||
html = html.replace(/([a-z0-9]+)_([0-9]+)/gi, '$$$1_{$2}$$');
|
||||
|
||||
// Symboles mathématiques courants
|
||||
const symbols = {
|
||||
'×': '\\times',
|
||||
'÷': '\\div',
|
||||
'≤': '\\leq',
|
||||
'≥': '\\geq',
|
||||
'≠': '\\neq',
|
||||
'≈': '\\approx',
|
||||
'∞': '\\infty',
|
||||
'√': '\\sqrt',
|
||||
'π': '\\pi',
|
||||
'∑': '\\sum',
|
||||
'∫': '\\int'
|
||||
};
|
||||
|
||||
for (let [symbol, latex] of Object.entries(symbols)) {
|
||||
html = html.replace(new RegExp(symbol, 'g'), '$' + latex + '$');
|
||||
}
|
||||
|
||||
return html;
|
||||
// Juste convertir \n en <br>
|
||||
// Le reste (LaTeX) est géré par KaTeX
|
||||
return texte.replace(/\n/g, '<br>');
|
||||
}
|
||||
|
||||
afficherTypingIndicator() {
|
||||
|
||||
Reference in New Issue
Block a user