Full-stack real-time group chat with Rust/Axum backend and Riot.js frontend. Features: - Auth (register/login/JWT), rooms, invites, WebSocket messaging - AI responses via OpenRouter with tool calling (Brave Search + web fetch) - Real-time tool usage indicators (searching/reading page) - Collapsible tool results in message bubbles - AI stats bar (model, tokens, speed, response time) persisted to DB - Room soft-delete, /clear command, dynamic model fetching - Markdown rendering with code highlighting and copy buttons Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
23 lines
550 B
JavaScript
23 lines
550 B
JavaScript
import MarkdownIt from 'markdown-it'
|
|
import hljs from 'highlight.js'
|
|
|
|
const md = new MarkdownIt({
|
|
html: false,
|
|
linkify: true,
|
|
typographer: true,
|
|
highlight(str, lang) {
|
|
if (lang && hljs.getLanguage(lang)) {
|
|
try {
|
|
return `<pre class="hljs"><code>${hljs.highlight(str, { language: lang }).value}</code></pre>`
|
|
} catch (_) {
|
|
// fall through
|
|
}
|
|
}
|
|
return `<pre class="hljs"><code>${md.utils.escapeHtml(str)}</code></pre>`
|
|
},
|
|
})
|
|
|
|
export function renderMarkdown(content) {
|
|
return md.render(content)
|
|
}
|