From 28231b9592b1af3684e274e9bdf5967140b02a40 Mon Sep 17 00:00:00 2001 From: Kazuya Takei Date: Sat, 23 Nov 2024 02:30:35 +0900 Subject: [PATCH] fix: Clean up --- src/html.tsx | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/html.tsx b/src/html.tsx index 23609f8..3ee8b3a 100644 --- a/src/html.tsx +++ b/src/html.tsx @@ -4,7 +4,6 @@ * This module is to manage routes for Web API (not render html and images). */ import { Hono } from 'hono'; -import { html, raw } from 'hono/html'; import { Octokit } from '@octokit/rest'; import { fetchContent } from './client'; import { Input } from './components'; @@ -12,7 +11,7 @@ import { parseSlug } from './models'; import type { ZennContent } from './models'; import { parseContentMarkdown } from './parser'; -const app = new Hono(); +const app = new Hono<{ Bindings: CloudflareBindings }>(); app.use(async (c, next) => { c.setRenderer((content) => { return c.html(`${content}`); @@ -103,9 +102,7 @@ app.get('/:slug', async (c) => { try { const md = await fetchContent(octokit, addr); props = parseContentMarkdown(md); - return c.html( - html` - + return c.render( @@ -116,19 +113,18 @@ app.get('/:slug', async (c) => { /> -
-

- ${props.frontMatter?.title} -
- ${props.frontMatter?.emoji} -

-
-
-
-
${raw(props.body)}
+
+

+ {props.frontMatter?.title} +
+ {props.frontMatter?.emoji} +

+
+
+
+
- - `, + , ); } catch (error) { console.error(error);