Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(bounties): markdown renderer, bounty detail polish, and CSS overhaul
nirholasc1d74bf56814
diff --git a/pages/bounties.html b/pages/bounties.htmlindex 7f1745065..6f4e02db2 100644--- a/pages/bounties.html+++ b/pages/bounties.html@@ -65,18 +65,43 @@</div><div class="controls">+ <label class="search" for="q">+ <svg+ class="search-ico"+ viewBox="0 0 20 20"+ fill="none"+ stroke="currentColor"+ stroke-width="1.8"+ aria-hidden="true"+ >+ <circle cx="9" cy="9" r="6" />+ <path d="M14 14l4 4" stroke-linecap="round" />+ </svg>+ <input+ id="q"+ type="search"+ placeholder="Search title, brief, or creator…"+ autocomplete="off"+ spellcheck="false"+ aria-label="Search bounties"+ />+ <button id="q-clear" class="q-clear" type="button" aria-label="Clear search" hidden>+ ×+ </button>+ </label><div class="seg" id="sort-seg" role="tablist" aria-label="Sort bounties"><button data-sort="reward" class="active">Top reward</button><button data-sort="newest">Newest</button><button data-sort="submissions">Most subs</button><button data-sort="likes">Most liked</button></div>- <div class="spacer"></div><button id="refresh-btn" class="btn btn-ghost btn-sm" aria-label="Refresh">↻ Refresh</button></div>+ <div class="result-meta" id="result-meta" hidden></div>+<div class="grid" id="grid"></div></main>diff --git a/public/pump-bounties.css b/public/pump-bounties.cssindex 17623bd56..6c8158bc6 100644--- a/public/pump-bounties.css+++ b/public/pump-bounties.css@@ -253,6 +253,100 @@ img {flex: 1;}+/* Search */+.search {+ display: flex;+ align-items: center;+ gap: 8px;+ flex: 1 1 240px;+ min-width: 180px;+ height: 38px;+ padding: 0 10px;+ background: var(--panel);+ border: 1px solid var(--border);+ border-radius: 10px;+ transition:+ border-color 0.15s,+ background 0.15s;+}+.search:focus-within {+ border-color: rgba(124, 92, 255, 0.5);+ background: var(--panel-hover);+}+.search-ico {+ width: 16px;+ height: 16px;+ color: var(--muted);+ flex-shrink: 0;+}+.search input {+ flex: 1;+ min-width: 0;+ background: none;+ border: none;+ outline: none;+ color: var(--text);+ font-size: 13.5px;+}+.search input::placeholder {+ color: var(--muted-2);+}+.search input[type='search']::-webkit-search-cancel-button {+ -webkit-appearance: none;+ appearance: none;+}+.q-clear {+ width: 20px;+ height: 20px;+ border-radius: 6px;+ color: var(--muted);+ font-size: 17px;+ line-height: 1;+ display: flex;+ align-items: center;+ justify-content: center;+ flex-shrink: 0;+ transition:+ background 0.14s,+ color 0.14s;+}+.q-clear:hover {+ background: var(--panel-hover);+ color: var(--text);+}++/* Result meta line */+.result-meta {+ display: flex;+ align-items: center;+ gap: 8px;+ font-size: 12.5px;+ color: var(--muted);+ padding: 0 2px 14px;+}+.result-meta strong {+ color: var(--text);+ font-weight: 700;+}+.result-meta .scan-dot {+ width: 7px;+ height: 7px;+ border-radius: 50%;+ background: var(--accent);+ box-shadow: 0 0 8px var(--accent);+ animation: scanpulse 1.1s ease-in-out infinite;+ flex-shrink: 0;+}+@keyframes scanpulse {+ 0%,+ 100% {+ opacity: 0.25;+ }+ 50% {+ opacity: 1;+ }+}+/* Grid + cards */.grid {display: grid;@@ -634,3 +728,102 @@ img {height: 14px;margin-bottom: 10px;}++/* Rendered Markdown (briefs + submission bodies) */+.md {+ white-space: normal;+}+.md > :first-child {+ margin-top: 0;+}+.md > :last-child {+ margin-bottom: 0;+}+.md p {+ margin: 0 0 12px;+}+.md h3,+.md h4,+.md h5,+.md h6 {+ font-weight: 700;+ line-height: 1.3;+ letter-spacing: -0.2px;+ margin: 18px 0 8px;+ color: var(--text);+}+.md h3 {+ font-size: 18px;+}+.md h4 {+ font-size: 16px;+}+.md h5,+.md h6 {+ font-size: 14px;+}+.md ul,+.md ol {+ margin: 0 0 12px;+ padding-left: 22px;+}+.md li {+ margin: 4px 0;+}+.md li::marker {+ color: var(--muted);+}+.md a {+ color: var(--accent);+ text-decoration: none;+ border-bottom: 1px solid transparent;+}+.md a:hover {+ border-bottom-color: currentColor;+}+.md strong {+ font-weight: 700;+ color: var(--text);+}+.md em {+ font-style: italic;+}+.md del {+ opacity: 0.6;+}+.md code {+ font-family: ui-monospace, 'JetBrains Mono', monospace;+ font-size: 0.88em;+ background: var(--panel);+ border: 1px solid var(--border);+ border-radius: 5px;+ padding: 1px 5px;+ word-break: break-word;+}+.md pre.md-pre {+ background: #0d0d14;+ border: 1px solid var(--border);+ border-radius: 10px;+ padding: 12px 14px;+ overflow-x: auto;+ margin: 0 0 12px;+}+.md pre.md-pre code {+ background: none;+ border: none;+ padding: 0;+ font-size: 12.5px;+ line-height: 1.55;+ color: rgba(240, 240, 248, 0.9);+}+.md blockquote {+ margin: 0 0 12px;+ padding: 4px 0 4px 14px;+ border-left: 3px solid var(--accent);+ color: var(--muted);+}+.md hr {+ border: none;+ border-top: 1px solid var(--border);+ margin: 18px 0;+}diff --git a/src/bounty-detail.js b/src/bounty-detail.jsindex 76023f1a1..93b2842e9 100644--- a/src/bounty-detail.js+++ b/src/bounty-detail.js@@ -5,6 +5,8 @@// breakdown, the on-chain escrow bridge (program / vault / creator → Solscan),// and the public submission feed. Read-only.+import { mdToHtml } from './md.js';+const SOLSCAN = 'https://solscan.io/account/';const taskId = (() => {@@ -40,7 +42,7 @@ function render(b, submissions) {<div class="detail-section"><h2>The brief</h2>- <div class="body-md">${esc(b.bodyMarkdown) || '<span style="color:var(--muted)">No description provided.</span>'}</div>+ <div class="body-md md">${b.bodyMarkdown ? mdToHtml(b.bodyMarkdown) : '<span style="color:var(--muted)">No description provided.</span>'}</div></div>${@@ -142,7 +144,7 @@ function submission(s) {<span>· ${esc(timeAgo(s.createdAt))}</span><span class="sub-likes">♥ ${s.likeCount}</span></div>- ${s.body ? `<div class="sub-body">${esc(s.body)}</div>` : ''}+ ${s.body ? `<div class="sub-body md">${mdToHtml(s.body)}</div>` : ''}${img.length? `<div class="gallery" style="margin-top:10px">${imgdiff --git a/src/md.js b/src/md.jsnew file mode 100644index 000000000..3ec753782--- /dev/null+++ b/src/md.js@@ -0,0 +1,143 @@+// Minimal, safe Markdown → HTML for pump.fun bounty briefs and submissions.+//+// pump.fun stores briefs and proofs as Markdown (`bodyMarkdown`). Rendering them+// as raw text loses headings, lists, links, and emphasis — so the detail page+// reads like a dump. This renders the common subset (headings, lists, quotes,+// code, emphasis, links, rules) with NO external dependency.+//+// Security: every block's text is HTML-escaped BEFORE any markup is inserted, so+// user content can never inject tags. Links are whitelisted to http(s), mailto,+// and root-relative paths — `javascript:` and friends stay inert text. The+// output is therefore safe to assign via innerHTML.++// Private-use sentinel that wraps stashed token indices. It can't appear in real+// content and survives HTML-escaping untouched, so emphasis rules never reach+// inside a code span or link, and literal numbers are never mistaken for tokens.+const SENT = String.fromCharCode(0xe000); // U+E000 private-use sentinel+const RESTORE = new RegExp(SENT + '(\\d+)' + SENT, 'g');++function esc(str) {+ if (str == null) return '';+ return String(str)+ .replace(/&/g, '&')+ .replace(/</g, '<')+ .replace(/>/g, '>')+ .replace(/"/g, '"')+ .replace(/'/g, ''');+}++// Inline formatting on already-escaped text. Code spans and links are stashed as+// sentinel-wrapped placeholders first so their contents aren't re-processed.+function inline(s) {+ const tokens = [];+ const stash = (html) => `${SENT}${tokens.push(html) - 1}${SENT}`;++ // [label](url) — whitelist safe schemes only.+ s = s.replace(+ /\[([^\]]+)\]\((https?:\/\/[^\s)]+|mailto:[^\s)]+|\/[^\s)]*)\)/g,+ (_, label, url) =>+ stash(`<a href="${url}" target="_blank" rel="noopener noreferrer nofollow">${label}</a>`),+ );+ // `inline code`+ s = s.replace(/`([^`]+)`/g, (_, code) => stash(`<code>${code}</code>`));+ // **bold** / __bold__+ s = s.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');+ s = s.replace(/__([^_]+)__/g, '<strong>$1</strong>');+ // *italic* / _italic_ (avoid matching list bullets or intra-word underscores)+ s = s.replace(/(^|[^*])\*([^*\s][^*]*?)\*/g, '$1<em>$2</em>');+ s = s.replace(/(^|[^_\w])_([^_\s][^_]*?)_/g, '$1<em>$2</em>');+ // ~~strike~~+ s = s.replace(/~~([^~]+)~~/g, '<del>$1</del>');+ // bare URL autolink (those inside a stashed anchor are already protected)+ s = s.replace(+ /(^|[\s(])(https?:\/\/[^\s<)]+)/g,+ (_, pre, url) =>+ `${pre}${stash(`<a href="${url}" target="_blank" rel="noopener noreferrer nofollow">${url}</a>`)}`,+ );++ return s.replace(RESTORE, (_, i) => tokens[+i]);+}++const RE_FENCE = /^```/;+const RE_BLANK = /^\s*$/;+const RE_HR = /^\s*([-*_])(\s*\1){2,}\s*$/;+const RE_HEAD = /^(#{1,6})\s+(.*)$/;+const RE_QUOTE = /^\s*>\s?/;+const RE_UL = /^\s*[-*+]\s+/;+const RE_OL = /^\s*\d+[.)]\s+/;++function startsBlock(line) {+ return (+ RE_FENCE.test(line) ||+ RE_HEAD.test(line) ||+ RE_QUOTE.test(line) ||+ RE_UL.test(line) ||+ RE_OL.test(line) ||+ RE_HR.test(line)+ );+}++export function mdToHtml(src) {+ if (src == null) return '';+ const lines = String(src)+ .replace(/\r\n?/g, '\n')+ .split('\n');+ const out = [];+ let i = 0;++ while (i < lines.length) {+ const line = lines[i];++ if (RE_FENCE.test(line)) {+ const buf = [];+ i++;+ while (i < lines.length && !RE_FENCE.test(lines[i])) buf.push(lines[i++]);+ i++; // closing fence (if present)+ out.push(`<pre class="md-pre"><code>${esc(buf.join('\n'))}</code></pre>`);+ continue;+ }+ if (RE_BLANK.test(line)) {+ i++;+ continue;+ }+ if (RE_HR.test(line)) {+ out.push('<hr/>');+ i++;+ continue;+ }+ const h = line.match(RE_HEAD);+ if (h) {+ const lvl = Math.min(6, h[1].length + 2); // # → h3, so it sits under the section h2+ out.push(`<h${lvl}>${inline(esc(h[2].trim()))}</h${lvl}>`);+ i++;+ continue;+ }+ if (RE_QUOTE.test(line)) {+ const buf = [];+ while (i < lines.length && RE_QUOTE.test(lines[i])) buf.push(lines[i++].replace(RE_QUOTE, ''));+ out.push(`<blockquote>${inline(esc(buf.join('\n'))).replace(/\n/g, '<br/>')}</blockquote>`);+ continue;+ }+ if (RE_UL.test(line)) {+ const buf = [];+ while (i < lines.length && RE_UL.test(lines[i])) buf.push(lines[i++].replace(RE_UL, ''));+ out.push(`<ul>${buf.map((li) => `<li>${inline(esc(li))}</li>`).join('')}</ul>`);+ continue;+ }+ if (RE_OL.test(line)) {+ const buf = [];+ while (i < lines.length && RE_OL.test(lines[i])) buf.push(lines[i++].replace(RE_OL, ''));+ out.push(`<ol>${buf.map((li) => `<li>${inline(esc(li))}</li>`).join('')}</ol>`);+ continue;+ }++ // Paragraph: gather consecutive non-blank, non-block lines.+ const buf = [];+ while (i < lines.length && !RE_BLANK.test(lines[i]) && !startsBlock(lines[i])) {+ buf.push(lines[i++]);+ }+ out.push(`<p>${inline(esc(buf.join('\n'))).replace(/\n/g, '<br/>')}</p>`);+ }++ return out.join('\n');+}