feat(ui): right-rail companion chat — streaming, tool chips, inline drafts
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
16
public/markdown.js
Normal file
16
public/markdown.js
Normal file
@@ -0,0 +1,16 @@
|
||||
// Shared markdown → sanitized HTML helper.
|
||||
// Used by the companion chat rail and any other component that needs
|
||||
// safe rendered markdown outside the full editor.
|
||||
|
||||
import { marked } from './vendor/marked.esm.js';
|
||||
import DOMPurify from './vendor/purify.es.mjs';
|
||||
|
||||
marked.setOptions({ gfm: true, breaks: true });
|
||||
|
||||
/**
|
||||
* Parse `src` as Markdown and return a DOMPurify-sanitized HTML string.
|
||||
* Safe to assign to element.innerHTML.
|
||||
*/
|
||||
export function renderMarkdown(src) {
|
||||
return DOMPurify.sanitize(marked.parse(src || ''));
|
||||
}
|
||||
Reference in New Issue
Block a user