mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Math formulas support Cohee1207/SillyTavern#26
This commit is contained in:
@ -32,6 +32,7 @@
|
||||
<script src="scripts/jquery.transit.min.js"></script>
|
||||
<script src="scripts/jquery-cookie-1.4.1.min.js"></script>
|
||||
<script src="scripts/showdown.min.js"></script>
|
||||
<script src="scripts/showdown-katex.min.js"></script>
|
||||
<script src="scripts/popper.js"></script>
|
||||
<script src="scripts/purify.min.js"></script>
|
||||
<script type="module" src="scripts/power-user.js"></script>
|
||||
|
@ -164,8 +164,20 @@ export {
|
||||
// API OBJECT FOR EXTERNAL WIRING
|
||||
window["SillyTavern"] = {};
|
||||
|
||||
let converter = new showdown.Converter({ emoji: "true" });
|
||||
const gpt3 = new GPT3BrowserTokenizer({ type: 'gpt3' });
|
||||
let converter = new showdown.Converter({
|
||||
emoji: "true",
|
||||
underline: "true",
|
||||
extensions: [
|
||||
showdownKatex(
|
||||
{
|
||||
delimiters: [
|
||||
{ left: '$$', right: '$$', display: true, asciimath: false },
|
||||
{ left: '$', right: '$', display: false, asciimath: true },
|
||||
]
|
||||
}
|
||||
)],
|
||||
});
|
||||
/* let bg_menu_toggle = false; */
|
||||
const systemUserName = "SillyTavern System";
|
||||
let default_user_name = "You";
|
||||
@ -901,8 +913,9 @@ function messageFormating(mes, ch_name, isSystem, forceAvatar) {
|
||||
return match;
|
||||
}
|
||||
});
|
||||
mes = mes.replaceAll('\\begin{align*}', '$$');
|
||||
mes = mes.replaceAll('\\end{align*}', '$$');
|
||||
mes = converter.makeHtml(mes);
|
||||
//mes = mes.replace(/{.*}/g, "");
|
||||
mes = mes.replace(/{{(\*?.+?\*?)}}/g, "");
|
||||
|
||||
mes = mes.replace(/\n/g, "<br/>");
|
||||
|
36
public/scripts/showdown-katex.min.js
vendored
Normal file
36
public/scripts/showdown-katex.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/scripts/showdown-katex.min.js.map
Normal file
1
public/scripts/showdown-katex.min.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -3580,6 +3580,10 @@ body.noShadows * {
|
||||
text-shadow: none !important;
|
||||
}
|
||||
|
||||
.katex-html {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ---------- @media queries must always go at the bottom ------------*/
|
||||
|
||||
/*will apply to anything 1000px or less. this catches ipads, horizontal phones, and vertical phones)*/
|
||||
|
Reference in New Issue
Block a user