Fix code snippet in markdoc README (#7592)
This commit is contained in:
parent
3153d04dad
commit
6f1c4ea388
1 changed files with 8 additions and 12 deletions
|
@ -105,13 +105,12 @@ This example renders an `Aside` component, and allows a `type` prop to be passed
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// markdoc.config.mjs
|
// markdoc.config.mjs
|
||||||
import { defineMarkdocConfig } from '@astrojs/markdoc/config';
|
import { defineMarkdocConfig, component } from '@astrojs/markdoc/config';
|
||||||
import Aside from './src/components/Aside.astro';
|
|
||||||
|
|
||||||
export default defineMarkdocConfig({
|
export default defineMarkdocConfig({
|
||||||
tags: {
|
tags: {
|
||||||
aside: {
|
aside: {
|
||||||
render: Aside,
|
render: component('./src/components/Aside.astro'),
|
||||||
attributes: {
|
attributes: {
|
||||||
// Markdoc requires type defs for each attribute.
|
// Markdoc requires type defs for each attribute.
|
||||||
// These should mirror the `Props` type of the component
|
// These should mirror the `Props` type of the component
|
||||||
|
@ -145,14 +144,13 @@ This example renders a `Heading.astro` component using the `render` property:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// markdoc.config.mjs
|
// markdoc.config.mjs
|
||||||
import { defineMarkdocConfig, nodes } from '@astrojs/markdoc/config';
|
import { defineMarkdocConfig, nodes, component } from '@astrojs/markdoc/config';
|
||||||
import Heading from './src/components/Heading.astro';
|
|
||||||
|
|
||||||
export default defineMarkdocConfig({
|
export default defineMarkdocConfig({
|
||||||
nodes: {
|
nodes: {
|
||||||
heading: {
|
heading: {
|
||||||
...nodes.heading, // Preserve default anchor link generation
|
...nodes.heading, // Preserve default anchor link generation
|
||||||
render: Heading,
|
render: component('./src/components/Heading.astro'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -239,14 +237,13 @@ This example renders blockquotes with a custom `Quote.astro` component:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// markdoc.config.mjs
|
// markdoc.config.mjs
|
||||||
import { defineMarkdocConfig, nodes } from '@astrojs/markdoc/config';
|
import { defineMarkdocConfig, nodes, component } from '@astrojs/markdoc/config';
|
||||||
import Quote from './src/components/Quote.astro';
|
|
||||||
|
|
||||||
export default defineMarkdocConfig({
|
export default defineMarkdocConfig({
|
||||||
nodes: {
|
nodes: {
|
||||||
blockquote: {
|
blockquote: {
|
||||||
...nodes.blockquote, // Apply Markdoc's defaults for other options
|
...nodes.blockquote, // Apply Markdoc's defaults for other options
|
||||||
render: Quote,
|
render: component('./src/components/Quote.astro'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -273,13 +270,12 @@ This Astro component can now be passed to the `render` prop for any [tag][markdo
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// markdoc.config.mjs
|
// markdoc.config.mjs
|
||||||
import { defineMarkdocConfig } from '@astrojs/markdoc/config';
|
import { defineMarkdocConfig, component } from '@astrojs/markdoc/config';
|
||||||
import ClientAside from './src/components/ClientAside.astro';
|
|
||||||
|
|
||||||
export default defineMarkdocConfig({
|
export default defineMarkdocConfig({
|
||||||
tags: {
|
tags: {
|
||||||
aside: {
|
aside: {
|
||||||
render: ClientAside,
|
render: component('./src/components/ClientAside.astro'),
|
||||||
attributes: {
|
attributes: {
|
||||||
type: { type: String },
|
type: { type: String },
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue