/
index.d.ts
239 lines (235 loc) · 6.9 KB
/
index.d.ts
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
export {default} from './lib/index.js'
/**
* Image metadata.
*/
export interface Image {
/**
* Alt text of image (optional, example: `'M.T.A. map designed in 1979'`).
*/
alt?: string | null | undefined
/**
* Height of image (optional, example: `'550'`).
*/
height?: number | string | null | undefined
/**
* URL of image (required, example:
* `'https://static01.nyt.com/images/…/mta-crop-jumbo.jpg'`).
*/
url: string
/**
* Width of image (optional, example: `'1050'`).
*/
width?: number | string | null | undefined
}
/**
* Configuration.
*/
export interface Options {
/**
* Name of the author of the document (optional, example: `'Jane Doe'`).
*
* Inferred by `unified-infer-git-meta` from Git or `vfile-matter` from
* frontmatter.
* Used by `rehype-meta`.
*/
author?: string | null | undefined
/**
* Facebook username of the author of the document (optional, example:
* `'example'`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
authorFacebook?: string | null | undefined
/**
* Twitter username of the author of the document (optional, example:
* `'@janedoe'`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
authorTwitter?: string | null | undefined
/**
* Hexadecimal theme color of document or site (optional, `'#bada55'`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
color?: string | null | undefined
/**
* Whether to add copyright metadata (default: `false`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
copyright?: boolean | null | undefined
/**
* Description of the document (optional, example: `'The city has changed
* drastically over the past 40 years, yet the M.T.A. map designed in 1979
* has largely endured.'`).
*
* Inferred by `rehype-infer-description-meta` from HTML or `vfile-matter`
* from frontmatter.
* Used by `rehype-meta`.
*/
description?: string | null | undefined
/**
* One or more images associated with the document (optional); if strings are
* passed, they are seen as `Image` objects with a `url` field set to that
* value.
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
image?: Array<Image | string> | Image | string | null | undefined
/**
* Date the document was last modified (example: `'2019-12-03T19:13:00.000Z'`).
*
* > 👉 **Note**: parsing a string is inconsistent, prefer dates.
*
* Inferred by `unified-infer-git-meta` from Git or `vfile-matter` from
* frontmatter.
* Used by `rehype-meta`.
*/
modified?: Date | string | null | undefined
/**
* Name of the whole site (optional, example: `'The New York Times'`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
name?: string | null | undefined
/**
* Whether to add Open Graph metadata (default: `false`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
og?: boolean | null | undefined
/**
* Whether to add the site name `name` to the `og:title` (default: `false`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
ogNameInTitle?: boolean | null | undefined
/**
* Origin the file will be hosted on (optional, example:
* `https://www.nytimes.com`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
origin?: string | null | undefined
/**
* Absolute pathname of where the file will be hosted (default: `/`,
* example: `/interactive/2019/12/02/nyregion/nyc-subway-map.html`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
pathname?: string | null | undefined
/**
* Date the document (or site) was first published (example:
* `'2019-12-03T19:13:00.000Z'`).
*
* > 👉 **Note**: parsing a string is inconsistent, prefer dates.
*
* Inferred by `unified-infer-git-meta` from Git or `vfile-matter` from
* frontmatter.
* Used by `rehype-meta`.
*/
published?: Date | string | null | undefined
/**
* Reading time of the document in minutes (optional); if two numbers are
* given, they represent a range of two estimates.
*
* Inferred by `rehype-infer-reading-time-meta` from HTML or `vfile-matter`
* from frontmatter.
* Used by `rehype-meta`.
*/
readingTime?:
| [lowEstimate: number, highEstimate: number]
| [estimate: number]
| number
| null
| undefined
/**
* Section associated with the document (optional, example: `'New York'`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
section?: string | null | undefined
/**
* Value to use to join the `title` and `name` together (default: `' - '`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
separator?: string | null | undefined
/**
* Name of the author of the whole site (optional, example: `'The New York
* Times'`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
siteAuthor?: string | null | undefined
/**
* Tags associated with the whole site (optional, example: `['US Politics',
* 'Impeachment', 'NATO', 'London', 'Food', 'Poverty', 'Climate Change',
* 'Global Warming']`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
siteTags?: string[] | null | undefined
/**
* Twitter username of the whole site (optional, example: `'@nytimes'`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
siteTwitter?: string | null | undefined
/**
* Tags associated with the document (optional, example: `['Subway', 'Map',
* 'Public Transit', 'Design', 'MTA', 'Massimo Vignelli', 'NYC']`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
tags?: string[] | null | undefined
/**
* Title of the document (optional, example: `'The New York City Subway Map
* as You’ve Never Seen It Before'`).
*
* Inferred by `rehype-infer-title-meta` from HTML or `vfile-matter` from
* frontmatter.
* Used by `rehype-document` and `rehype-meta`.
*/
title?: string | null | undefined
/**
* Whether to add Twitter metadata (default: `false`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
twitter?: boolean | null | undefined
/**
* What the document refers to (default: `'website'`).
*
* Inferred by `vfile-matter` from frontmatter.
* Used by `rehype-meta`.
*/
type?: 'article' | 'website' | null | undefined
}
// Add custom data supported when `rehype-meta` is added.
declare module 'vfile' {
interface DataMapMatter extends Options {}
interface DataMapMeta extends Options {}
interface DataMap {
matter: DataMapMatter
meta: DataMapMeta
}
}