How_To_Render_Html_String_In_Astro

方法

---
import { compileContent } from 'astro:content';

const posts = await Astro.glob('../pages/posts/*.md');

const compiledPosts = await Promise.all(posts.map(async (post) => {
  const { content } = await compileContent(post);
  return content;
}));
---

<main>
  {compiledPosts.map((html, index) => (
    <div key={index} set:html={html}></div>
  ))}
</main>

参照