Skip to content

Commit

Permalink
♻️ Prevent html tags or newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
penrodlol committed May 27, 2024
1 parent 4a213ef commit 506af03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { toString } from 'mdast-util-to-string';
export default async function () {
const posts = await getCollection('posts');
const postsSearches = posts
.map((post) => ({ slug: post.slug, body: toString(fromMarkdown(post.body)) }))
.map((post) => sql`(${post.slug}, ${post.body})`);
.map((post) => ({ slug: post.slug, body: toString(fromMarkdown(post.body), { includeHtml: false }) }))
.map((post) => sql`(${post.slug}, ${post.body.replaceAll('\n', ' ')})`);

await db.batch([
db.insert(PostView).values(posts.map((post) => ({ post: post.slug }))),
Expand Down

0 comments on commit 506af03

Please sign in to comment.