Blogging platform with advanced tools for arts and sciences.
6

Configure Feed

Select the types of activity you want to include in your feed.

Fix textContent on post creation

lemma (Jun 5, 2026, 1:51 PM -0500) c1ba01c1 1837b6ca

+21 -1
+21 -1
infra/api/src/index.ts
··· 255 255 } 256 256 } 257 257 258 + function markdownToText(markdown: string): string { 259 + return markdown 260 + .replace(/```[\s\S]*?```/g, '') 261 + .replace(/^#{1,6}\s+/gm, '') 262 + .replace(/\*{1,3}([^*]+)\*{1,3}/g, '$1') 263 + .replace(/_{1,3}([^_]+)_{1,3}/g, '$1') 264 + .replace(/~~([^~]+)~~/g, '$1') 265 + .replace(/`([^`]+)`/g, '$1') 266 + .replace(/!\[[^\]]*\]\([^)]*\)/g, '') 267 + .replace(/\[([^\]]+)\]\([^)]*\)/g, '$1') 268 + .replace(/^>\s?/gm, '') 269 + .replace(/^\s*[-*+]\s+/gm, '') 270 + .replace(/^\s*\d+[.)]\s+/gm, '') 271 + .replace(/^[-*_]{3,}$/gm, '') 272 + .replace(/<[^>]+>/g, '') 273 + .replace(/[^\S\n]+/g, ' ') 274 + .replace(/\n{3,}/g, '\n\n') 275 + .trim() 276 + } 277 + 258 278 const FEED_PAGE_SIZE = 20 259 279 260 280 async function getFeed(event: APIGatewayProxyEventV2): Promise<APIGatewayProxyResultV2> { ··· 426 446 atUri, site, resolvedUrl, resolvedPubName, resolvedHandle, path, title, publishedAt, 427 447 }; 428 448 if (updatedAt !== undefined) item.updatedAt = updatedAt; 429 - if (content !== undefined) item.content = content; 449 + if (content !== undefined) { item.content = content; item.textContent = markdownToText(content); } 430 450 if (coverImageRef !== undefined) item.coverImageRef = coverImageRef; 431 451 if (bskyPostRef !== undefined) item.bskyPostRef = bskyPostRef; 432 452 if (license !== undefined) item.license = license;