From 12e5f3ef716bc5c5bfbec3edbc3d2f73f30d307a Mon Sep 17 00:00:00 2001 From: flameleaf <18636550+flameleaf@users.noreply.github.com> Date: Fri, 20 Feb 2026 13:34:53 -0800 Subject: [PATCH] feat(route/chub): support markdown and move thumbnail image to description (#21184) * Update api url * remove trailing ' * feat(route/chub): support markdown and move thumbnail image to description * style: auto format --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- lib/routes/chub/characters.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/routes/chub/characters.ts b/lib/routes/chub/characters.ts index 0ed1d8a44..ae237a85f 100644 --- a/lib/routes/chub/characters.ts +++ b/lib/routes/chub/characters.ts @@ -1,7 +1,16 @@ +import MarkdownIt from 'markdown-it'; + import type { Route } from '@/types'; import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; +const md = MarkdownIt({ + breaks: true, + html: true, + linkify: true, + typographer: true, +}); + export const route: Route = { path: '/characters', categories: ['new-media'], @@ -14,6 +23,10 @@ export const route: Route = { }, }; +function convertUndefinedToString(value: any): string { + return value === undefined ? '' : value.toString(); +} + async function handler() { const hostURL = 'https://www.chub.ai/characters'; const apiURL = 'https://api.chub.ai/search'; @@ -52,13 +65,13 @@ async function handler() { link: hostURL, item: nodes.map((item) => ({ title: item.name, - description: `${item.tagline}

${item.description}`, + description: `
${item.tagline}
${md.render(convertUndefinedToString(item.description))}
`, pubDate: parseDate(item.createdAt), updated: parseDate(item.lastActivityAt), link: `${hostURL}/${item.fullPath}`, author: String(item.fullPath.split('/', 1)), - enclosure_url: item.avatar_url, - enclosure_type: `image/webp`, + enclosure_url: item.max_res_url, + enclosure_type: `image/png`, category: item.topics, })), };