import type { InlinePlugin } from "../types.ts"; import { escape } from "@dbushell/hyperless"; const REGEXP = /!\[([^\]]+)\]\(([^()\s]+)\)/g; const plugin: InlinePlugin = { type: "image", render: (text: string) => { if (text.includes("![") === false) { return text; } for (const match of text.matchAll(REGEXP)) { const alt = escape(match[1]); const src = escape(match[2]); text = text.replace( match[0], () => `${alt}`, ); } return text; }, }; export default plugin;