mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add code syntax highlight
This commit is contained in:
@ -165,6 +165,7 @@ export {
|
||||
window["SillyTavern"] = {};
|
||||
|
||||
const gpt3 = new GPT3BrowserTokenizer({ type: 'gpt3' });
|
||||
hljs.addPlugin({"before:highlightElement": ({ el }) => { el.textContent = el.innerText } });
|
||||
let converter = new showdown.Converter({
|
||||
emoji: "true",
|
||||
underline: "true",
|
||||
@ -974,6 +975,7 @@ function addCopyToCodeBlocks(messageElement) {
|
||||
document.body.removeChild(copiedMsg);
|
||||
}, 2500);
|
||||
});
|
||||
hljs.highlightElement(codeBlocks.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1299,6 +1301,7 @@ class StreamingProcessor {
|
||||
onFinishStreaming(messageId, text) {
|
||||
this.hideStopButton(this.messageId);
|
||||
this.onProgressStreaming(messageId, text);
|
||||
addCopyToCodeBlocks($(`#chat .mes[mesid="${messageId}"]`));
|
||||
playMessageSound();
|
||||
saveChatConditional();
|
||||
activateSendButtons();
|
||||
|
Reference in New Issue
Block a user