Spaces:
Running
Running
Improve frontend markdown rendering
Browse filesFiles changed (4)
1v0.0.431v0.0.44
609 unmodified lines610611612613614615609 unmodified linesborder-radius: 14px;}.markdown-body table {width: 100%;border-collapse: collapse;609 unmodified lines610611612613614615616617618619620621622623624625609 unmodified linesborder-radius: 14px;}.mermaid-chart {margin: 0.85rem 0;overflow-x: auto;}.mermaid-chart svg {max-width: 100%;height: auto;}.markdown-body table {width: 100%;border-collapse: collapse;
151 unmodified lines15215315415515615739 unmodified lines19719819920020120213 unmodified lines216217218219220221222223224225226227228309 unmodified lines538539540541542543151 unmodified linesvar workspaceMeta = document.getElementById("workspaceMeta");var downloadWorkspaceBtn = document.getElementById("downloadWorkspaceBtn");var defaultPromptPlaceholder = promptInput.getAttribute("placeholder") || "Message ResearchHarness";function escapeHtml(value) {return String(value || "")39 unmodified linesreturn template.innerHTML;}function renderMathInMarkdown(container) {if (!window.renderMathInElement) return;container.querySelectorAll(".markdown-body").forEach(function (body) {13 unmodified lines});}function renderMarkdown(text) {if (!window.marked || !window.DOMPurify) {console.warn("Markdown renderer unavailable; falling back to plain text.");return "<pre>" + escapeHtml(text) + "</pre>";}try {var protectedMath = protectMathSegments(text);var rawHtml = window.marked.parse(protectedMath.text, { gfm: true, breaks: false, async: false });rawHtml = rewriteWorkspaceImageSources(rawHtml);var safeHtml = window.DOMPurify.sanitize(rawHtml, { USE_PROFILES: { html: true } });309 unmodified lines});timeline.appendChild(node);renderMathInMarkdown(node);setEventExpanded(node, true, false);scrollTimeline(shouldFollow);}151 unmodified lines15215315415515615715839 unmodified lines19819920020120220320420520620720820913 unmodified lines223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259309 unmodified lines569570571572573574575151 unmodified linesvar workspaceMeta = document.getElementById("workspaceMeta");var downloadWorkspaceBtn = document.getElementById("downloadWorkspaceBtn");var defaultPromptPlaceholder = promptInput.getAttribute("placeholder") || "Message ResearchHarness";var mermaidCounter = 0;function escapeHtml(value) {return String(value || "")39 unmodified linesreturn template.innerHTML;}function unwrapFullMarkdownFence(text) {var source = String(text || "").trim();var match = /^(```|~~~)[ \t]*(markdown|md|gfm)[^\n]*\n([\s\S]*?)\n\1[ \t]*$/i.exec(source);return match ? match[3] : text;}function renderMathInMarkdown(container) {if (!window.renderMathInElement) return;container.querySelectorAll(".markdown-body").forEach(function (body) {13 unmodified lines});}function renderMermaidInMarkdown(container) {if (!window.mermaid) return;try {window.mermaid.initialize({ startOnLoad: false, securityLevel: "strict" });} catch (e) {console.warn("Mermaid initialization failed.", e);return;}container.querySelectorAll(".markdown-body pre code.language-mermaid").forEach(function (code) {var pre = code.closest("pre");if (!pre) return;var source = code.textContent || "";var target = document.createElement("div");var id = "rh-mermaid-" + (++mermaidCounter);target.className = "mermaid-chart";window.mermaid.render(id, source).then(function (result) {target.innerHTML = result.svg || "";pre.replaceWith(target);}).catch(function (e) {console.warn("Mermaid rendering failed.", e);});});}function renderMarkdown(text) {if (!window.marked || !window.DOMPurify) {console.warn("Markdown renderer unavailable; falling back to plain text.");return "<pre>" + escapeHtml(text) + "</pre>";}try {var protectedMath = protectMathSegments(unwrapFullMarkdownFence(text));var rawHtml = window.marked.parse(protectedMath.text, { gfm: true, breaks: false, async: false });rawHtml = rewriteWorkspaceImageSources(rawHtml);var safeHtml = window.DOMPurify.sanitize(rawHtml, { USE_PROFILES: { html: true } });309 unmodified lines});timeline.appendChild(node);renderMathInMarkdown(node);renderMermaidInMarkdown(node);setEventExpanded(node, true, false);scrollTimeline(shouldFollow);}
73 unmodified lines74757677787973 unmodified lines<script src="https://cdn.jsdelivr.net/npm/marked@15.0.12/marked.min.js"></script><script src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"></script><script src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js"></script><script src="/static/app.js"></script></body></html>73 unmodified lines7475767778798073 unmodified lines<script src="https://cdn.jsdelivr.net/npm/marked@15.0.12/marked.min.js"></script><script src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"></script><script src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js"></script><script src="https://cdn.jsdelivr.net/npm/mermaid@11.12.0/dist/mermaid.min.js"></script><script src="/static/app.js"></script></body></html>
VERSION+1-1
frontend/static/app.css+10
frontend/static/app.js+33-1
frontend/static/index.html+1