HTML block: render as HTML, e.g. in case of a full proxy

This commit is contained in:
Enrico Ros
2023-09-29 07:29:20 -07:00
parent 5272fa972a
commit b2f7c6f204
@@ -10,6 +10,11 @@ export function parseBlocks(forceText: boolean, text: string): Block[] {
if (forceText)
return [{ type: 'text', content: text }];
// noinspection HtmlRequiredTitleElement
// special case: this could be generated by a proxy that returns an HTML page instead of the API response
if (text.startsWith('<!DOCTYPE html') || text.startsWith('<head>\n'))
return [{ type: 'html', html: text }];
const regexPatterns = {
codeBlock: /`{3,}([\w\\.+-_]+)?\n([\s\S]*?)(`{3,}\n?|$)/g,
imageBlock: /(https:\/\/images\.prodia\.xyz\/.*?\.png)/g, // NOTE: only Prodia for now - but this shall be expanded to markdown images ![alt](url) or any png/jpeg