diff --git a/src/template.tsx b/src/template.tsx index 6d260fa..5afd3dc 100644 --- a/src/template.tsx +++ b/src/template.tsx @@ -1,27 +1,21 @@ -import { Body, Column, Html, render, Section } from 'jsx-email' +import React from 'preact/compat' //for jsx-email +import { render } from 'jsx-email' +// @deno-types="npm:turndown" +import Turndown from 'turndown' +import { JSX } from 'preact' -function Email() { - return ( - - -
- First column - Second column -
- - - ) +const htmlToMd = new Turndown({ + headingStyle: 'atx', + codeBlockStyle: 'fenced', +}) + +export async function renderTemplate( + template: JSX.Element, +): Promise<{ html: string; text: string }> { + const html = await render(template) + + return { + html, + text: htmlToMd.turndown(html), + } } - -// console.log(await render(Email)) -// import { render } from 'npm:preact-render-to-string' - -// function Email() { -// return ( -// -//

Test

-// -// ) -// } - -console.log(await render())