import React from 'https://esm.sh/react@18.2.0'; // eslint-disable-next-line import/extensions import { ImageResponse } from 'https://deno.land/x/og_edge/mod.ts'; const MAX_AUTHORS = 5; export default async function handler(req: Request) { const params = new URL(req.url).searchParams; const title = params.get('title'); const authors = params.get('authors'); const product = params.get('product'); const description = params.get('description'); const parsedAuthors = authors && authors .split(',') .map((author) => { const [name, github] = author.split('@'); return { name: name.trim(), github: github.trim() }; }) .filter(({ name, github }) => name && github); const withAuthors = parsedAuthors && parsedAuthors.length > 0; let starCount = 0; return new ImageResponse( (
{product}
{line.split('*').flatMap((text, index) => { if (index > 0) { starCount += 1; } const isBlue = starCount % 2 === 1; return text.split(' ').map((word) => ( 0 ? 15 : 0, }} > {word} )); })}
))} {description && ({description}
)}