mirror of
https://github.com/vercel/streamdown.git
synced 2026-09-19 02:18:37 +08:00
c3a2eaaca7
* Add type safety to remark plugins * Move harden-react-markdown defaults to props * Change switch to if to avoid default clause * Use save-file for table * Use for-of * Write custom save function * Remove use of state in image * Update image.tsx * Use existing save function * Create khaki-facts-fly.md
16 lines
572 B
TypeScript
16 lines
572 B
TypeScript
import { type ClassValue, clsx } from 'clsx';
|
|
import { twMerge } from 'tailwind-merge';
|
|
|
|
export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));
|
|
|
|
export const save = (filename: string, content: string | Blob, mimeType: string) => {
|
|
const blob = typeof content === 'string' ? new Blob([content], { type: mimeType }) : content;
|
|
const url = URL.createObjectURL(blob);
|
|
const a = document.createElement("a");
|
|
a.href = url;
|
|
a.download = filename;
|
|
document.body.appendChild(a);
|
|
a.click();
|
|
document.body.removeChild(a);
|
|
URL.revokeObjectURL(url);
|
|
}; |