Skip to content

Instantly share code, notes, and snippets.

@jasikpark
Created March 24, 2023 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasikpark/aaa0e4bbe7d596cd6011cac2268b9591 to your computer and use it in GitHub Desktop.
Save jasikpark/aaa0e4bbe7d596cd6011cac2268b9591 to your computer and use it in GitHub Desktop.
Imagined example of an SSR endpoint that returns the markdown sent in the request rendered in an Astro page shell as html
---
import { Markdown } from 'astro-remote';
import MainLayout from "@layouts/MainLayout.astro";
const markdown = Astro.request.headers.get('markdown');
---
<html>
<MainLayout>
<h1>My ODB post page</h1
<!-- Disallow inline `style` attributes, but allow HTML comments -->
<Markdown content={markdown} sanitize={{ dropAttributes: { "style": ["*"] }, allowComments: true }} />
</MainLayout>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment