Adding layout and content attributes to astro Markdown component #34
schlichtanders
started this conversation in
Proposal
Replies: 2 comments 3 replies
-
How is this different from ---
import { BaseLayout } from '../layouts/BaseLayout.astro;
import { Markdown } from 'astro/components';
---
<BaseLayout>
<Markdown title="MyTitle">
</Markdown>
</BaseLayout> ? |
Beta Was this translation helpful? Give feedback.
3 replies
-
More context for this RFC can be found in withastro/astro#1792 - the usecase seems to be supporting all of the I would argue that the best way to support this would be something like ---
// '/src/pages/hello-world.astro'
import renderMarkdown from "astro/markdown";
import BaseLayout from "../components/BaseLayout.astro";
const title = "Hello World";
---
<BaseLayout content={renderMarkdown({ source: `
# Hello World
```js
console.log('hello world'); this is how you program :)
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As astro
Markdown
components would ideally be at least as well supported as markdown files,it would be nice to have
layout
and thecontent
prop also forMarkdown
astro component within an astro file.Here my suggestion: Add them as properties to the Markdown tag
such that BaseLayout is called with
Astro.props.content == {title: "MyTitle}
, i.e. following the current markdown convention.Beta Was this translation helpful? Give feedback.
All reactions