-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmarkdoc.config.mjs
118 lines (117 loc) · 3.04 KB
/
markdoc.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import { defineMarkdocConfig, component, nodes } from '@astrojs/markdoc/config';
export default defineMarkdocConfig({
nodes: {
blockquote: {
...nodes.blockquote,
render: component('./src/components/Note.astro'),
},
fence: {
attributes: {
...nodes.fence.attributes,
title: { type: String, render: 'title' },
mark: { type: Number, render: 'mark' }
},
render: component('./src/components/Fence.astro'),
},
image: {
...nodes.image,
render: component('./src/components/Figure.astro'),
attributes: {
src: { type: String },
alt: { type: String },
},
},
link: {
...nodes.link,
render: component('./src/components/Link.astro'),
validate(node) {
const { href } = node.attributes;
if (!href) {
return [
{
id: 'link-href',
level: 'error',
message: `Link href is required.`,
}
];
}
if (node.children.length !== 1 && !href.startsWith('mailto:')) {
return [
{
id: 'link-href',
level: 'error',
message: `Link URLs should be masked with readable text. See ${href}`,
}
];
}
if (href.startsWith('https://docs.centrapay.com')) {
return [
{
id: 'link-href',
level: 'error',
message: `Internal link hrefs should be relative links. See ${href}`,
}
];
}
return [];
},
},
},
tags: {
badge: {
render: component('./src/components/Badge.astro'),
attributes: {
type: { type: String },
},
},
endpoint: {
render: component('./src/components/Endpoint.astro'),
attributes: {
filename: { type: String },
path: { type: String },
},
},
error: {
render: component('./src/components/Error.astro'),
attributes: {
code: { type: String },
message: { type: String },
},
},
farmlandsSolutionCard: {
render: component('./src/components/SolutionCard.astro'),
attributes: {
description: { type: String },
imageSrc: { type: String },
linkText: { type: String },
linkUrl: { type: String },
title: { type: String },
},
},
gridList: {
render: component('./src/components/Grid.astro'),
attributes: {
class: { type: String },
},
},
properties: {
render: component('./src/components/Properties.astro'),
attributes: {
heading: { type: String },
},
},
property: {
render: component('./src/components/Property.astro'),
attributes: {
deprecated: { type: Boolean },
experimental: { type: Boolean },
name: { type: String },
required: { type: Boolean },
type: { type: String },
},
},
mermaid: {
render: component('./src/components/Mermaid.astro'),
},
},
});