From: mgroeber9110 Date: Wed, 24 Apr 2024 10:54:24 +0000 (+0200) Subject: server : do not apply Markdown formatting in code sections (#6850) X-Git-Tag: upstream/0.0.4488~1764 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=3fe847b5747676ee1bf90371c46ed0bc66b57240;p=pkg%2Fggml%2Fsources%2Fllama.cpp server : do not apply Markdown formatting in code sections (#6850) --- diff --git a/examples/server/public/index.html b/examples/server/public/index.html index 9fe61eb1..2961999f 100644 --- a/examples/server/public/index.html +++ b/examples/server/public/index.html @@ -881,11 +881,11 @@ .replace(/&/g, '&') .replace(//g, '>') - .replace(/^#{1,6} (.*)$/gim, '

$1

') - .replace(/\*\*(.*?)\*\*/g, '$1') - .replace(/__(.*?)__/g, '$1') - .replace(/\*(.*?)\*/g, '$1') - .replace(/_(.*?)_/g, '$1') + .replace(/(^|\n)#{1,6} ([^\n]*)(?=([^`]*`[^`]*`)*[^`]*$)/g, '$1

$2

') + .replace(/\*\*(.*?)\*\*(?=([^`]*`[^`]*`)*[^`]*$)/g, '$1') + .replace(/__(.*?)__(?=([^`]*`[^`]*`)*[^`]*$)/g, '$1') + .replace(/\*(.*?)\*(?=([^`]*`[^`]*`)*[^`]*$)/g, '$1') + .replace(/_(.*?)_(?=([^`]*`[^`]*`)*[^`]*$)/g, '$1') .replace(/```.*?\n([\s\S]*?)```/g, '
$1
') .replace(/`(.*?)`/g, '$1') .replace(/\n/gim, '
');