Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code snippet in markdoc README #7592

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions packages/integrations/markdoc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,12 @@ This example renders an `Aside` component, and allows a `type` prop to be passed

```js
// markdoc.config.mjs
import { defineMarkdocConfig } from '@astrojs/markdoc/config';
import Aside from './src/components/Aside.astro';
import { defineMarkdocConfig, component } from '@astrojs/markdoc/config';

export default defineMarkdocConfig({
tags: {
aside: {
render: Aside,
render: component('./src/components/Aside.astro'),
attributes: {
// Markdoc requires type defs for each attribute.
// These should mirror the `Props` type of the component
Expand Down Expand Up @@ -145,14 +144,13 @@ This example renders a `Heading.astro` component using the `render` property:

```js
// markdoc.config.mjs
import { defineMarkdocConfig, nodes } from '@astrojs/markdoc/config';
import Heading from './src/components/Heading.astro';
import { defineMarkdocConfig, nodes, component } from '@astrojs/markdoc/config';

export default defineMarkdocConfig({
nodes: {
heading: {
...nodes.heading, // Preserve default anchor link generation
render: Heading,
render: component('./src/components/Heading.astro'),
},
},
});
Expand Down Expand Up @@ -239,14 +237,13 @@ This example renders blockquotes with a custom `Quote.astro` component:

```js
// markdoc.config.mjs
import { defineMarkdocConfig, nodes } from '@astrojs/markdoc/config';
import Quote from './src/components/Quote.astro';
import { defineMarkdocConfig, nodes, component } from '@astrojs/markdoc/config';

export default defineMarkdocConfig({
nodes: {
blockquote: {
...nodes.blockquote, // Apply Markdoc's defaults for other options
render: Quote,
render: component('./src/components/Quote.astro'),
},
},
});
Expand All @@ -273,13 +270,12 @@ This Astro component can now be passed to the `render` prop for any [tag][markdo

```js
// markdoc.config.mjs
import { defineMarkdocConfig } from '@astrojs/markdoc/config';
import ClientAside from './src/components/ClientAside.astro';
import { defineMarkdocConfig, component } from '@astrojs/markdoc/config';

export default defineMarkdocConfig({
tags: {
aside: {
render: ClientAside,
render: component('./src/components/ClientAside.astro'),
attributes: {
type: { type: String },
},
Expand Down