From 78e3a57857132d036a672997b97c7400e09176dc Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Tue, 2 Apr 2024 21:07:35 -0700 Subject: [PATCH] parsing of HTML code blocks --- src/modules/blocks/blocks.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/blocks/blocks.ts b/src/modules/blocks/blocks.ts index 5caad1407..a5f47b4f9 100644 --- a/src/modules/blocks/blocks.ts +++ b/src/modules/blocks/blocks.ts @@ -57,6 +57,7 @@ export function parseMessageBlocks(text: string, disableParsing: boolean, forceT const regexPatterns = { codeBlock: /`{3,}([\w\x20\\.+-_]+)?\n([\s\S]*?)(`{3,}\n?|$)/g, + htmlCodeBlock: /([\s\S]*?)<\/html>/g, svgBlock: //g, latexBlock: /\$\$([\s\S]*?)\$\$\n?/g, latexBlock2: /\\\[\n([\s\S]*?)\n\s*\\]\n/g, @@ -96,6 +97,12 @@ export function parseMessageBlocks(text: string, disableParsing: boolean, forceT blocks.push({ type: 'code', blockTitle, blockCode, complete: blockEnd.startsWith('```') }); break; + + case 'htmlCodeBlock': + const html: string = `${match[1]}`; + blocks.push({ type: 'code', blockTitle: 'html', blockCode: html, complete: true }); + break; + case 'latexBlock': case 'latexBlock2': const latex: string = match[1];