personal-website/markdoc.config.ts
2024-04-19 14:51:33 +02:00

47 lines
1 KiB
TypeScript

import { component, defineMarkdocConfig } from '@astrojs/markdoc/config';
function mdocComponent(name: string) {
return component(`./src/components/mdoc/${name}.astro`);
}
export default defineMarkdocConfig({
nodes: {
paragraph: {
render: mdocComponent('Paragraph'),
},
heading: {
render: mdocComponent('Heading'),
attributes: { level: { type: Number } },
},
list: {
render: mdocComponent('List'),
attributes: {
ordered: { type: Boolean },
marker: {
type: String,
},
},
},
link: {
render: mdocComponent('InlineLink'),
attributes: { href: { type: String } },
},
item: {
render: mdocComponent('BulletListItem'),
attributes: {},
},
hr: {
render: mdocComponent('HorizontalBreak'),
},
},
tags: {
ShowableFigure: {
render: mdocComponent('ShowableFigure'),
attributes: {
image: { type: String, required: true },
altText: { type: String, required: true },
},
},
},
});