test: update fixture to match new config

This commit is contained in:
bholmesdev 2023-03-01 14:21:08 -05:00
parent 95dab5393b
commit 4186664db0
4 changed files with 33 additions and 47 deletions

View file

@ -3,5 +3,22 @@ import markdoc from '@astrojs/markdoc';
// https://astro.build/config
export default defineConfig({
integrations: [markdoc()],
integrations: [markdoc({
variables: {
showMarquee: true,
},
tags: {
mq: {
render: 'marquee',
attributes: {
direction: {
type: String,
default: 'left',
matches: ['left', 'right', 'up', 'down'],
errorLevel: 'critical',
},
},
},
}
})],
});

View file

@ -0,0 +1,12 @@
---
import { Code } from 'astro/components';
type Props = {
'data-language'?: string;
}
const { 'data-language': lang } = Astro.props as Props;
const code = await Astro.slots.render('default');
---
<Code {code} {lang} />

View file

@ -1,8 +1,7 @@
---
import { getEntryBySlug } from "astro:content";
import { Code } from 'astro/components';
import Code from '../components/Code.astro';
import CustomMarquee from '../components/CustomMarquee.astro';
import Markdoc from '@markdoc/markdoc';
const post = await getEntryBySlug('blog', 'with-components');
const { Content } = await post.render();
@ -18,32 +17,9 @@ const { Content } = await post.render();
</head>
<body>
<Content
config={{
tags: {
mq: {
render: 'marquee',
attributes: {
direction: {
type: String,
default: 'left',
matches: ['left', 'right', 'up', 'down'],
errorLevel: 'critical',
},
},
},
}
}}
components={{
marquee: CustomMarquee,
pre: {
component: Code,
props({ attributes, getTreeNode }) {
return {
lang: attributes['data-language'],
code: Markdoc.renderers.html(getTreeNode().children),
};
},
},
pre: Code,
}}
/>
</body>

View file

@ -14,25 +14,6 @@ const { Content } = await post.render();
<title>Content - with config</title>
</head>
<body>
<Content
config={{
variables: {
showMarquee: true,
},
tags: {
mq: {
render: 'marquee',
attributes: {
direction: {
type: String,
default: 'left',
matches: ['left', 'right', 'up', 'down'],
errorLevel: 'critical',
},
},
},
}
}}
/>
<Content />
</body>
</html>