@astrojs/markdoc 0.0.0-markdoc-20230214163516

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +620 -0
  3. package/LICENSE +61 -0
  4. package/README.md +160 -0
  5. package/components/RenderNode.astro +30 -0
  6. package/components/Renderer.astro +14 -0
  7. package/components/astroNode.ts +64 -0
  8. package/components/index.ts +2 -0
  9. package/dist/index.d.ts +4 -0
  10. package/dist/index.js +57 -0
  11. package/dist/utils.d.ts +6 -0
  12. package/dist/utils.js +20 -0
  13. package/package.json +54 -0
  14. package/src/index.ts +50 -0
  15. package/src/utils.ts +25 -0
  16. package/template/content-module-types.d.ts +20 -0
  17. package/test/content-collections.test.js +181 -0
  18. package/test/fixtures/content-collections/astro.config.mjs +7 -0
  19. package/test/fixtures/content-collections/node_modules/.bin/astro +17 -0
  20. package/test/fixtures/content-collections/package.json +13 -0
  21. package/test/fixtures/content-collections/src/components/CustomMarquee.astro +1 -0
  22. package/test/fixtures/content-collections/src/content/blog/simple.mdoc +7 -0
  23. package/test/fixtures/content-collections/src/content/blog/with-components.mdoc +17 -0
  24. package/test/fixtures/content-collections/src/content/blog/with-config.mdoc +14 -0
  25. package/test/fixtures/content-collections/src/content/config.ts +12 -0
  26. package/test/fixtures/content-collections/src/pages/collection.json.js +10 -0
  27. package/test/fixtures/content-collections/src/pages/content-simple.astro +18 -0
  28. package/test/fixtures/content-collections/src/pages/content-with-components.astro +50 -0
  29. package/test/fixtures/content-collections/src/pages/content-with-config.astro +38 -0
  30. package/test/fixtures/content-collections/src/pages/entry.json.js +10 -0
  31. package/test/fixtures/content-collections/utils.js +8 -0
  32. package/tsconfig.json +10 -0
@@ -0,0 +1,5 @@
1
+ @astrojs/markdoc:build: cache hit, replaying output 175697f8e70856a0
2
+ @astrojs/markdoc:build: 
3
+ @astrojs/markdoc:build: > @astrojs/markdoc@0.0.0-markdoc-20230214163516 build /home/runner/work/astro/astro/packages/integrations/markdoc
4
+ @astrojs/markdoc:build: > astro-scripts build "src/**/*.ts" && tsc
5
+ @astrojs/markdoc:build: 
package/CHANGELOG.md ADDED
@@ -0,0 +1,620 @@
1
+ # @astrojs/mdx
2
+
3
+ ## 0.0.0-markdoc-20230214163516
4
+
5
+ ### Patch Changes
6
+
7
+ - [#6209](https://github.com/withastro/astro/pull/6209) [`94a2ddb2a`](https://github.com/withastro/astro/commit/94a2ddb2ac89fb0d892eadefeeba129d3dcc0acb) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Introduce the (experimental) `@astrojs/markdoc` integration. This unlocks Markdoc inside your Content Collections, and brings support for Astro and UI components in your content. This also improves internals to make Content Collections extensible to more file types in the future.
8
+
9
+ ## 0.16.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#6050](https://github.com/withastro/astro/pull/6050) [`2ab32b59e`](https://github.com/withastro/astro/commit/2ab32b59ef0a28d34757f2c2adb9cf2baa86855e) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Fix: load syntax highlighters after MDX remark plugins. This keeps MDX consistent with Astro's markdown behavior.
14
+
15
+ ### Patch Changes
16
+
17
+ - [#6062](https://github.com/withastro/astro/pull/6062) [`c6cf847bd`](https://github.com/withastro/astro/commit/c6cf847bd0b6bef3c51a5710fba5ca43b11e46f9) Thanks [@delucis](https://github.com/delucis)! - Update MDX README
18
+
19
+ ## 0.15.2
20
+
21
+ ### Patch Changes
22
+
23
+ - [#5478](https://github.com/withastro/astro/pull/5478) [`1c7eef308`](https://github.com/withastro/astro/commit/1c7eef308e808aa5ed4662b53e67ec8d1b814d1f) Thanks [@nemo0](https://github.com/nemo0)! - Update READMEs for consistency
24
+
25
+ ## 0.15.1
26
+
27
+ ### Patch Changes
28
+
29
+ - [#5978](https://github.com/withastro/astro/pull/5978) [`7abb1e905`](https://github.com/withastro/astro/commit/7abb1e9056c4b4fd0abfced347df32a41cdfbf28) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fix MDX heading IDs generation when using a frontmatter reference
30
+
31
+ - Updated dependencies [[`7abb1e905`](https://github.com/withastro/astro/commit/7abb1e9056c4b4fd0abfced347df32a41cdfbf28)]:
32
+ - @astrojs/markdown-remark@2.0.1
33
+
34
+ ## 0.15.0
35
+
36
+ ### Minor Changes
37
+
38
+ - [#5684](https://github.com/withastro/astro/pull/5684) [`a9c292026`](https://github.com/withastro/astro/commit/a9c2920264e36cc5dc05f4adc1912187979edb0d) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Refine Markdown and MDX configuration options for ease-of-use. & [#5769](https://github.com/withastro/astro/pull/5769) [`93e633922`](https://github.com/withastro/astro/commit/93e633922c2e449df3bb2357b3683af1d3c0e07b) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Introduce a `smartypants` flag to opt-out of Astro's default SmartyPants plugin.
39
+
40
+ - **Markdown**
41
+
42
+ - **Replace the `extendDefaultPlugins` option** with a `gfm` boolean and a `smartypants` boolean. These are enabled by default, and can be disabled to remove GitHub-Flavored Markdown and SmartyPants.
43
+
44
+ - Ensure GitHub-Flavored Markdown and SmartyPants are applied whether or not custom `remarkPlugins` or `rehypePlugins` are configured. If you want to apply custom plugins _and_ remove Astro's default plugins, manually set `gfm: false` and `smartypants: false` in your config.
45
+
46
+ - **Migrate `extendDefaultPlugins` to `gfm` and `smartypants`**
47
+
48
+ You may have disabled Astro's built-in plugins (GitHub-Flavored Markdown and Smartypants) with the `extendDefaultPlugins` option. This has now been split into 2 flags to disable each plugin individually:
49
+
50
+ - `markdown.gfm` to disable GitHub-Flavored Markdown
51
+ - `markdown.smartypants` to disable SmartyPants
52
+
53
+ ```diff
54
+ // astro.config.mjs
55
+ import { defineConfig } from 'astro/config';
56
+
57
+ export default defineConfig({
58
+ markdown: {
59
+ - extendDefaultPlugins: false,
60
+ + smartypants: false,
61
+ + gfm: false,
62
+ }
63
+ });
64
+ ```
65
+
66
+ Additionally, applying remark and rehype plugins **no longer disables** `gfm` and `smartypants`. You will need to opt-out manually by setting `gfm` and `smartypants` to `false`.
67
+
68
+ - **MDX**
69
+
70
+ - Support _all_ Markdown configuration options (except `drafts`) from your MDX integration config. This includes `syntaxHighlighting` and `shikiConfig` options to further customize the MDX renderer.
71
+
72
+ - Simplify `extendPlugins` to an `extendMarkdownConfig` option. MDX options will default to their equivalent in your Markdown config. By setting `extendMarkdownConfig` to false, you can "eject" to set your own syntax highlighting, plugins, and more.
73
+
74
+ - **Migrate MDX's `extendPlugins` to `extendMarkdownConfig`**
75
+
76
+ You may have used the `extendPlugins` option to manage plugin defaults in MDX. This has been replaced by 3 flags:
77
+
78
+ - `extendMarkdownConfig` (`true` by default) to toggle Markdown config inheritance. This replaces the `extendPlugins: 'markdown'` option.
79
+ - `gfm` (`true` by default) and `smartypants` (`true` by default) to toggle GitHub-Flavored Markdown and SmartyPants in MDX. This replaces the `extendPlugins: 'defaults'` option.
80
+
81
+ - [#5687](https://github.com/withastro/astro/pull/5687) [`e2019be6f`](https://github.com/withastro/astro/commit/e2019be6ffa46fa33d92cfd346f9ecbe51bb7144) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Give remark and rehype plugins access to user frontmatter via frontmatter injection. This means `data.astro.frontmatter` is now the _complete_ Markdown or MDX document's frontmatter, rather than an empty object.
82
+
83
+ This allows plugin authors to modify existing frontmatter, or compute new properties based on other properties. For example, say you want to compute a full image URL based on an `imageSrc` slug in your document frontmatter:
84
+
85
+ ```ts
86
+ export function remarkInjectSocialImagePlugin() {
87
+ return function (tree, file) {
88
+ const { frontmatter } = file.data.astro;
89
+ frontmatter.socialImageSrc = new URL(frontmatter.imageSrc, 'https://my-blog.com/').pathname;
90
+ };
91
+ }
92
+ ```
93
+
94
+ When using Content Collections, you can access this modified frontmatter using the `remarkPluginFrontmatter` property returned when rendering an entry.
95
+
96
+ **Migration instructions**
97
+
98
+ Plugin authors should now **check for user frontmatter when applying defaults.**
99
+
100
+ For example, say a remark plugin wants to apply a default `title` if none is present. Add a conditional to check if the property is present, and update if none exists:
101
+
102
+ ```diff
103
+ export function remarkInjectTitlePlugin() {
104
+ return function (tree, file) {
105
+ const { frontmatter } = file.data.astro;
106
+ + if (!frontmatter.title) {
107
+ frontmatter.title = 'Default title';
108
+ + }
109
+ }
110
+ }
111
+ ```
112
+
113
+ This differs from previous behavior, where a Markdown file's frontmatter would _always_ override frontmatter injected via remark or reype.
114
+
115
+ - [#5891](https://github.com/withastro/astro/pull/5891) [`05caf445d`](https://github.com/withastro/astro/commit/05caf445d4d2728f1010aeb2179a9e756c2fd17d) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Remove deprecated Markdown APIs from Astro v0.X. This includes `getHeaders()`, the `.astro` property for layouts, and the `rawContent()` and `compiledContent()` error messages for MDX.
116
+
117
+ - [#5782](https://github.com/withastro/astro/pull/5782) [`1f92d64ea`](https://github.com/withastro/astro/commit/1f92d64ea35c03fec43aff64eaf704dc5a9eb30a) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Remove support for Node 14. Minimum supported Node version is now >=16.12.0
118
+
119
+ - [#5825](https://github.com/withastro/astro/pull/5825) [`52209ca2a`](https://github.com/withastro/astro/commit/52209ca2ad72a30854947dcb3a90ab4db0ac0a6f) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Baseline the experimental `contentCollections` flag. You're free to remove this from your astro config!
120
+
121
+ ```diff
122
+ import { defineConfig } from 'astro/config';
123
+
124
+ export default defineConfig({
125
+ - experimental: { contentCollections: true }
126
+ })
127
+ ```
128
+
129
+ ### Patch Changes
130
+
131
+ - [#5837](https://github.com/withastro/astro/pull/5837) [`12f65a4d5`](https://github.com/withastro/astro/commit/12f65a4d55e3fd2993c2f67b18794dd536280c69) Thanks [@giuseppelt](https://github.com/giuseppelt)! - fix shiki css class replace logic
132
+
133
+ - [#5741](https://github.com/withastro/astro/pull/5741) [`000d3e694`](https://github.com/withastro/astro/commit/000d3e6940839c2aebba1984e6fb3b133cec6749) Thanks [@delucis](https://github.com/delucis)! - Fix broken links in README
134
+
135
+ - Updated dependencies [[`93e633922`](https://github.com/withastro/astro/commit/93e633922c2e449df3bb2357b3683af1d3c0e07b), [`e2019be6f`](https://github.com/withastro/astro/commit/e2019be6ffa46fa33d92cfd346f9ecbe51bb7144), [`1f92d64ea`](https://github.com/withastro/astro/commit/1f92d64ea35c03fec43aff64eaf704dc5a9eb30a), [`12f65a4d5`](https://github.com/withastro/astro/commit/12f65a4d55e3fd2993c2f67b18794dd536280c69), [`16107b6a1`](https://github.com/withastro/astro/commit/16107b6a10514ef1b563e585ec9add4b14f42b94), [`a9c292026`](https://github.com/withastro/astro/commit/a9c2920264e36cc5dc05f4adc1912187979edb0d), [`52209ca2a`](https://github.com/withastro/astro/commit/52209ca2ad72a30854947dcb3a90ab4db0ac0a6f), [`7572f7402`](https://github.com/withastro/astro/commit/7572f7402238da37de748be58d678fedaf863b53)]:
136
+ - @astrojs/markdown-remark@2.0.0
137
+ - @astrojs/prism@2.0.0
138
+
139
+ ## 1.0.0-beta.2
140
+
141
+ <details>
142
+ <summary>See changes in 1.0.0-beta.2</summary>
143
+
144
+ ### Major Changes
145
+
146
+ - [#5825](https://github.com/withastro/astro/pull/5825) [`52209ca2a`](https://github.com/withastro/astro/commit/52209ca2ad72a30854947dcb3a90ab4db0ac0a6f) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Baseline the experimental `contentCollections` flag. You're free to remove this from your astro config!
147
+
148
+ ```diff
149
+ import { defineConfig } from 'astro/config';
150
+
151
+ export default defineConfig({
152
+ - experimental: { contentCollections: true }
153
+ })
154
+ ```
155
+
156
+ ### Minor Changes
157
+
158
+ - [#5782](https://github.com/withastro/astro/pull/5782) [`1f92d64ea`](https://github.com/withastro/astro/commit/1f92d64ea35c03fec43aff64eaf704dc5a9eb30a) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Remove support for Node 14. Minimum supported Node version is now >=16.12.0
159
+
160
+ ### Patch Changes
161
+
162
+ - [#5837](https://github.com/withastro/astro/pull/5837) [`12f65a4d5`](https://github.com/withastro/astro/commit/12f65a4d55e3fd2993c2f67b18794dd536280c69) Thanks [@giuseppelt](https://github.com/giuseppelt)! - fix shiki css class replace logic
163
+
164
+ - Updated dependencies [[`1f92d64ea`](https://github.com/withastro/astro/commit/1f92d64ea35c03fec43aff64eaf704dc5a9eb30a), [`12f65a4d5`](https://github.com/withastro/astro/commit/12f65a4d55e3fd2993c2f67b18794dd536280c69), [`16107b6a1`](https://github.com/withastro/astro/commit/16107b6a10514ef1b563e585ec9add4b14f42b94), [`52209ca2a`](https://github.com/withastro/astro/commit/52209ca2ad72a30854947dcb3a90ab4db0ac0a6f), [`7572f7402`](https://github.com/withastro/astro/commit/7572f7402238da37de748be58d678fedaf863b53)]:
165
+ - @astrojs/prism@2.0.0-beta.0
166
+ - @astrojs/markdown-remark@2.0.0-beta.2
167
+
168
+ </details>
169
+
170
+ ## 0.15.0-beta.1
171
+
172
+ <details>
173
+ <summary>See changes in 0.15.0-beta.1</summary>
174
+
175
+ ### Minor Changes
176
+
177
+ - [#5769](https://github.com/withastro/astro/pull/5769) [`93e633922`](https://github.com/withastro/astro/commit/93e633922c2e449df3bb2357b3683af1d3c0e07b) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Introduce a `smartypants` flag to opt-out of Astro's default SmartyPants plugin.
178
+
179
+ ```js
180
+ {
181
+ markdown: {
182
+ smartypants: false,
183
+ }
184
+ }
185
+ ```
186
+
187
+ #### Migration
188
+
189
+ You may have disabled Astro's built-in plugins (GitHub-Flavored Markdown and Smartypants) with the `extendDefaultPlugins` option. This has now been split into 2 flags to disable each plugin individually:
190
+
191
+ - `markdown.gfm` to disable GitHub-Flavored Markdown
192
+ - `markdown.smartypants` to disable SmartyPants
193
+
194
+ ```diff
195
+ // astro.config.mjs
196
+ import { defineConfig } from 'astro/config';
197
+
198
+ export default defineConfig({
199
+ markdown: {
200
+ - extendDefaultPlugins: false,
201
+ + smartypants: false,
202
+ + gfm: false,
203
+ }
204
+ });
205
+ ```
206
+
207
+ ### Patch Changes
208
+
209
+ - [#5741](https://github.com/withastro/astro/pull/5741) [`000d3e694`](https://github.com/withastro/astro/commit/000d3e6940839c2aebba1984e6fb3b133cec6749) Thanks [@delucis](https://github.com/delucis)! - Fix broken links in README
210
+
211
+ - Updated dependencies [[`93e633922`](https://github.com/withastro/astro/commit/93e633922c2e449df3bb2357b3683af1d3c0e07b)]:
212
+ - @astrojs/markdown-remark@2.0.0-beta.1
213
+
214
+ </details>
215
+
216
+ ## 0.15.0-beta.0
217
+
218
+ <details>
219
+ <summary>See changes in 0.15.0-beta.0</summary>
220
+
221
+ ### Minor Changes
222
+
223
+ - [#5687](https://github.com/withastro/astro/pull/5687) [`e2019be6f`](https://github.com/withastro/astro/commit/e2019be6ffa46fa33d92cfd346f9ecbe51bb7144) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Give remark and rehype plugins access to user frontmatter via frontmatter injection. This means `data.astro.frontmatter` is now the _complete_ Markdown or MDX document's frontmatter, rather than an empty object.
224
+
225
+ This allows plugin authors to modify existing frontmatter, or compute new properties based on other properties. For example, say you want to compute a full image URL based on an `imageSrc` slug in your document frontmatter:
226
+
227
+ ```ts
228
+ export function remarkInjectSocialImagePlugin() {
229
+ return function (tree, file) {
230
+ const { frontmatter } = file.data.astro;
231
+ frontmatter.socialImageSrc = new URL(frontmatter.imageSrc, 'https://my-blog.com/').pathname;
232
+ };
233
+ }
234
+ ```
235
+
236
+ #### Content Collections - new `remarkPluginFrontmatter` property
237
+
238
+ We have changed _inject_ frontmatter to _modify_ frontmatter in our docs to improve discoverability. This is based on support forum feedback, where "injection" is rarely the term used.
239
+
240
+ To reflect this, the `injectedFrontmatter` property has been renamed to `remarkPluginFrontmatter`. This should clarify this plugin is still separate from the `data` export Content Collections expose today.
241
+
242
+ #### Migration instructions
243
+
244
+ Plugin authors should now **check for user frontmatter when applying defaults.**
245
+
246
+ For example, say a remark plugin wants to apply a default `title` if none is present. Add a conditional to check if the property is present, and update if none exists:
247
+
248
+ ```diff
249
+ export function remarkInjectTitlePlugin() {
250
+ return function (tree, file) {
251
+ const { frontmatter } = file.data.astro;
252
+ + if (!frontmatter.title) {
253
+ frontmatter.title = 'Default title';
254
+ + }
255
+ }
256
+ }
257
+ ```
258
+
259
+ This differs from previous behavior, where a Markdown file's frontmatter would _always_ override frontmatter injected via remark or reype.
260
+
261
+ - [#5684](https://github.com/withastro/astro/pull/5684) [`a9c292026`](https://github.com/withastro/astro/commit/a9c2920264e36cc5dc05f4adc1912187979edb0d) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Refine Markdown and MDX configuration options for ease-of-use.
262
+
263
+ #### Markdown
264
+
265
+ - **Remove `remark-smartypants`** from Astro's default Markdown plugins.
266
+ - **Replace the `extendDefaultPlugins` option** with a simplified `gfm` boolean. This is enabled by default, and can be disabled to remove GitHub-Flavored Markdown.
267
+ - Ensure GitHub-Flavored Markdown is applied whether or not custom `remarkPlugins` or `rehypePlugins` are configured. If you want to apply custom plugins _and_ remove GFM, manually set `gfm: false` in your config.
268
+
269
+ #### MDX
270
+
271
+ - Support _all_ Markdown configuration options (except `drafts`) from your MDX integration config. This includes `syntaxHighlighting` and `shikiConfig` options to further customize the MDX renderer.
272
+ - Simplify `extendDefaults` to an `extendMarkdownConfig` option. MDX options will default to their equivalent in your Markdown config. By setting `extendMarkdownConfig` to false, you can "eject" to set your own syntax highlighting, plugins, and more.
273
+
274
+ #### Migration
275
+
276
+ To preserve your existing Markdown and MDX setup, you may need some configuration changes:
277
+
278
+ ##### Smartypants manual installation
279
+
280
+ [Smartypants](https://github.com/silvenon/remark-smartypants) has been removed from Astro's default setup. If you rely on this plugin, [install `remark-smartypants`](https://github.com/silvenon/remark-smartypants#installing) and apply to your `astro.config.*`:
281
+
282
+ ```diff
283
+ // astro.config.mjs
284
+ import { defineConfig } from 'astro/config';
285
+ + import smartypants from 'remark-smartypants';
286
+
287
+ export default defineConfig({
288
+ markdown: {
289
+ + remarkPlugins: [smartypants],
290
+ }
291
+ });
292
+ ```
293
+
294
+ ##### Migrate `extendDefaultPlugins` to `gfm`
295
+
296
+ You may have disabled Astro's built-in plugins (GitHub-Flavored Markdown and Smartypants) with the `extendDefaultPlugins` option. Since Smartypants has been removed, this has been renamed to `gfm`.
297
+
298
+ ```diff
299
+ // astro.config.mjs
300
+ import { defineConfig } from 'astro/config';
301
+
302
+ export default defineConfig({
303
+ markdown: {
304
+ - extendDefaultPlugins: false,
305
+ + gfm: false,
306
+ }
307
+ });
308
+ ```
309
+
310
+ Additionally, applying remark and rehype plugins **no longer disables** `gfm`. You will need to opt-out manually by setting `gfm` to `false`.
311
+
312
+ ##### Migrate MDX's `extendPlugins` to `extendMarkdownConfig`
313
+
314
+ You may have used the `extendPlugins` option to manage plugin defaults in MDX. This has been replaced by 2 flags:
315
+
316
+ - `extendMarkdownConfig` (`true` by default) to toggle Markdown config inheritance. This replaces the `extendPlugins: 'markdown'` option.
317
+ - `gfm` (`true` by default) to toggle GitHub-Flavored Markdown in MDX. This replaces the `extendPlugins: 'defaults'` option.
318
+
319
+ ### Patch Changes
320
+
321
+ - Updated dependencies [[`e2019be6f`](https://github.com/withastro/astro/commit/e2019be6ffa46fa33d92cfd346f9ecbe51bb7144), [`a9c292026`](https://github.com/withastro/astro/commit/a9c2920264e36cc5dc05f4adc1912187979edb0d)]:
322
+ - @astrojs/markdown-remark@2.0.0-beta.0
323
+
324
+ </details>
325
+
326
+ ## 0.14.0
327
+
328
+ ### Minor Changes
329
+
330
+ - [#5654](https://github.com/withastro/astro/pull/5654) [`2c65b433b`](https://github.com/withastro/astro/commit/2c65b433bf840a1bb93b0a1947df5949e33512ff) Thanks [@delucis](https://github.com/delucis)! - Run heading ID injection after user plugins
331
+
332
+ ⚠️ BREAKING CHANGE ⚠️
333
+
334
+ If you are using a rehype plugin that depends on heading IDs injected by Astro, the IDs will no longer be available when your plugin runs by default.
335
+
336
+ To inject IDs before your plugins run, import and add the `rehypeHeadingIds` plugin to your `rehypePlugins` config:
337
+
338
+ ```diff
339
+ // astro.config.mjs
340
+ + import { rehypeHeadingIds } from '@astrojs/markdown-remark';
341
+ import mdx from '@astrojs/mdx';
342
+
343
+ export default {
344
+ integrations: [mdx()],
345
+ markdown: {
346
+ rehypePlugins: [
347
+ + rehypeHeadingIds,
348
+ otherPluginThatReliesOnHeadingIDs,
349
+ ],
350
+ },
351
+ }
352
+ ```
353
+
354
+ ### Patch Changes
355
+
356
+ - [#5667](https://github.com/withastro/astro/pull/5667) [`a5ba4af79`](https://github.com/withastro/astro/commit/a5ba4af79930145f4edf66d45cd40ddad045cc86) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Chore: remove verbose "Now interiting Markdown plugins..." logs
357
+
358
+ - [#5648](https://github.com/withastro/astro/pull/5648) [`853081d1c`](https://github.com/withastro/astro/commit/853081d1c857d8ad8a9634c37ed8fd123d32d241) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Prevent relative image paths in `src/content/`
359
+
360
+ - Updated dependencies [[`853081d1c`](https://github.com/withastro/astro/commit/853081d1c857d8ad8a9634c37ed8fd123d32d241), [`2c65b433b`](https://github.com/withastro/astro/commit/2c65b433bf840a1bb93b0a1947df5949e33512ff)]:
361
+ - @astrojs/markdown-remark@1.2.0
362
+
363
+ ## 0.13.0
364
+
365
+ ### Minor Changes
366
+
367
+ - [#5291](https://github.com/withastro/astro/pull/5291) [`5ec0f6ed5`](https://github.com/withastro/astro/commit/5ec0f6ed55b0a14a9663a90a03428345baf126bd) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Introduce Content Collections experimental API
368
+ - Organize your Markdown and MDX content into easy-to-manage collections.
369
+ - Add type safety to your frontmatter with schemas.
370
+ - Generate landing pages, static routes, and SSR endpoints from your content using the collection query APIs.
371
+
372
+ ## 0.12.2
373
+
374
+ ### Patch Changes
375
+
376
+ - [#5586](https://github.com/withastro/astro/pull/5586) [`f4ff69a3c`](https://github.com/withastro/astro/commit/f4ff69a3cd874c8804c6d01c7cbbaed8a8e90be7) Thanks [@delucis](https://github.com/delucis)! - Fix link in MDX integration README
377
+
378
+ - [#5570](https://github.com/withastro/astro/pull/5570) [`3f811eb68`](https://github.com/withastro/astro/commit/3f811eb682d55bd1f908f9b4bc3b795d2859d713) Thanks [@sarah11918](https://github.com/sarah11918)! - Revise README
379
+
380
+ ## 0.12.1
381
+
382
+ ### Patch Changes
383
+
384
+ - [#5522](https://github.com/withastro/astro/pull/5522) [`efc4363e0`](https://github.com/withastro/astro/commit/efc4363e0baf7f92900e20af339811bb3df42b0e) Thanks [@delucis](https://github.com/delucis)! - Support use of `<Fragment>` in MDX files rendered with `<Content />` component
385
+
386
+ ## 0.12.0
387
+
388
+ ### Minor Changes
389
+
390
+ - [#5427](https://github.com/withastro/astro/pull/5427) [`2a1c085b1`](https://github.com/withastro/astro/commit/2a1c085b199f24e34424ec8c19041c03602c53c5) Thanks [@backflip](https://github.com/backflip)! - Uses remark-rehype options from astro.config.mjs
391
+
392
+ ### Patch Changes
393
+
394
+ - [#5448](https://github.com/withastro/astro/pull/5448) [`ef2ffc7ae`](https://github.com/withastro/astro/commit/ef2ffc7ae9ff554860238ecd2fb3bf6d82b5801b) Thanks [@delucis](https://github.com/delucis)! - Fix broken link in README
395
+
396
+ ## 0.11.6
397
+
398
+ ### Patch Changes
399
+
400
+ - [#5335](https://github.com/withastro/astro/pull/5335) [`dca762cf7`](https://github.com/withastro/astro/commit/dca762cf734a657d8f126fd6958892b6163a4f67) Thanks [@bluwy](https://github.com/bluwy)! - Preserve code element node `data.meta` in `properties.metastring` for rehype syntax highlighters, like `rehype-pretty-code``
401
+
402
+ ## 0.11.5
403
+
404
+ ### Patch Changes
405
+
406
+ - [#5146](https://github.com/withastro/astro/pull/5146) [`308e565ad`](https://github.com/withastro/astro/commit/308e565ad39957e3353d72ca5d3bbce1a1b45008) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Support recmaPlugins config option
407
+
408
+ ## 0.11.4
409
+
410
+ ### Patch Changes
411
+
412
+ - [#4953](https://github.com/withastro/astro/pull/4953) [`a59731995`](https://github.com/withastro/astro/commit/a59731995b93ae69c21dc3adc5c8b482b466d12e) Thanks [@bluwy](https://github.com/bluwy)! - Log markdown hints with console.info
413
+
414
+ ## 0.11.3
415
+
416
+ ### Patch Changes
417
+
418
+ - [#4842](https://github.com/withastro/astro/pull/4842) [`812658ad2`](https://github.com/withastro/astro/commit/812658ad2ab3732a99e35c4fd903e302e723db46) Thanks [@bluwy](https://github.com/bluwy)! - Add missing dependencies, support strict dependency installation (e.g. pnpm)
419
+
420
+ ## 0.11.2
421
+
422
+ ### Patch Changes
423
+
424
+ - [#4700](https://github.com/withastro/astro/pull/4700) [`e5f71142e`](https://github.com/withastro/astro/commit/e5f71142eb62bd72456e889dad5774347c3753f2) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Document MDXLayoutProps utility type
425
+
426
+ - [#4858](https://github.com/withastro/astro/pull/4858) [`58a2dca22`](https://github.com/withastro/astro/commit/58a2dca2286cb14f6211cf51267c02447e78433a) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Correctly parse import.meta.env in MDX files
427
+
428
+ ## 0.11.1
429
+
430
+ ### Patch Changes
431
+
432
+ - [#4588](https://github.com/withastro/astro/pull/4588) [`db38f61b2`](https://github.com/withastro/astro/commit/db38f61b2b2dc55f03b28797d19b163b1940f1c8) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Fix: Add GFM and Smartypants to MDX by default
433
+
434
+ ## 0.11.0
435
+
436
+ ### Minor Changes
437
+
438
+ - [#4504](https://github.com/withastro/astro/pull/4504) [`8f8dff4d3`](https://github.com/withastro/astro/commit/8f8dff4d339a3a12ee155d81a97132032ef3b622) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Introduce new `extendPlugins` configuration option. This defaults to inheriting all remark and rehype plugins from your `markdown` config, with options to use either Astro's defaults or no inheritance at all.
439
+
440
+ ## 0.10.3
441
+
442
+ ### Patch Changes
443
+
444
+ - [#4519](https://github.com/withastro/astro/pull/4519) [`a2e8e76c3`](https://github.com/withastro/astro/commit/a2e8e76c303e8d6f39c24c122905a10f06907997) Thanks [@JuanM04](https://github.com/JuanM04)! - Upgraded Shiki to v0.11.1
445
+
446
+ - [#4530](https://github.com/withastro/astro/pull/4530) [`8504cd79b`](https://github.com/withastro/astro/commit/8504cd79b708e0d3bf1a2bb4ff9b86936bdd692b) Thanks [@kylebutts](https://github.com/kylebutts)! - Add custom components to README
447
+
448
+ ## 0.10.2
449
+
450
+ ### Patch Changes
451
+
452
+ - [#4423](https://github.com/withastro/astro/pull/4423) [`d4cd7a59f`](https://github.com/withastro/astro/commit/d4cd7a59fd38d411c442a818cfaab40f74106628) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Update Markdown type signature to match new markdown plugin,and update top-level layout props for better alignment
453
+
454
+ ## 0.10.2-next.0
455
+
456
+ ### Patch Changes
457
+
458
+ - [#4423](https://github.com/withastro/astro/pull/4423) [`d4cd7a59f`](https://github.com/withastro/astro/commit/d4cd7a59fd38d411c442a818cfaab40f74106628) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Update Markdown type signature to match new markdown plugin,and update top-level layout props for better alignment
459
+
460
+ ## 0.10.1
461
+
462
+ ### Patch Changes
463
+
464
+ - [#4443](https://github.com/withastro/astro/pull/4443) [`adb207979`](https://github.com/withastro/astro/commit/adb20797962c280d4d38f335f577fd52a1b48d4b) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Fix MDX style imports when layout is not applied
465
+
466
+ * [#4428](https://github.com/withastro/astro/pull/4428) [`a2414bf59`](https://github.com/withastro/astro/commit/a2414bf59e2e2cd633aece68e724401c4ad281b9) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Fix dev server reload performance when globbing from an MDX layout
467
+
468
+ ## 0.10.0
469
+
470
+ ### Minor Changes
471
+
472
+ - [#4292](https://github.com/withastro/astro/pull/4292) [`f1a52c18a`](https://github.com/withastro/astro/commit/f1a52c18afe66e6d310743ae6884be76f69be265) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Switch from Shiki Twoslash to Astro's Shiki Markdown highlighter
473
+
474
+ ## 0.9.0
475
+
476
+ ### Minor Changes
477
+
478
+ - [#4268](https://github.com/withastro/astro/pull/4268) [`f7afdb889`](https://github.com/withastro/astro/commit/f7afdb889fe4e97177958c8ec92f80c5f6e5cb51) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Align MD with MDX on layout props and "glob" import results:
479
+ - Add `Content` to MDX
480
+ - Add `file` and `url` to MDX frontmatter (layout import only)
481
+ - Update glob types to reflect differences (lack of `rawContent` and `compiledContent`)
482
+
483
+ ### Patch Changes
484
+
485
+ - [#4272](https://github.com/withastro/astro/pull/4272) [`24d2f7a6e`](https://github.com/withastro/astro/commit/24d2f7a6e6700c10c863f826f37bb653d70e3a83) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Properly handle hydration for namespaced components
486
+
487
+ ## 0.8.3
488
+
489
+ ### Patch Changes
490
+
491
+ - [#4248](https://github.com/withastro/astro/pull/4248) [`869d00935`](https://github.com/withastro/astro/commit/869d0093596b709cfcc1a1a95ee631b48d6d1c26) Thanks [@svemat01](https://github.com/svemat01)! - Load builtin rehype plugins before user plugins instead of after
492
+
493
+ * [#4255](https://github.com/withastro/astro/pull/4255) [`411612808`](https://github.com/withastro/astro/commit/4116128082121ee276d51cb245bf8095be4728a1) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Pass injected frontmatter from remark and rehype plugins to layouts
494
+
495
+ * Updated dependencies [[`1f0dd31d9`](https://github.com/withastro/astro/commit/1f0dd31d9239b5e3dca99c88d021e7a9a3e2054d)]:
496
+ - @astrojs/prism@1.0.1
497
+
498
+ ## 0.8.2
499
+
500
+ ### Patch Changes
501
+
502
+ - [#4237](https://github.com/withastro/astro/pull/4237) [`9d5ab5508`](https://github.com/withastro/astro/commit/9d5ab55086964fbede17da3d78c209c6d8d13711) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Update "Astro.props.content" -> "Astro.props.frontmatter" in README
503
+
504
+ ## 0.8.1
505
+
506
+ ### Patch Changes
507
+
508
+ - Updated dependencies [[`04ad44563`](https://github.com/withastro/astro/commit/04ad445632c67bdd60c1704e1e0dcbcaa27b9308)]:
509
+ - @astrojs/prism@1.0.0
510
+
511
+ ## 0.8.0
512
+
513
+ ### Minor Changes
514
+
515
+ - [#4204](https://github.com/withastro/astro/pull/4204) [`4c2ca5352`](https://github.com/withastro/astro/commit/4c2ca5352d0c4119ed2a9e5e0b78ce71eb1b414a) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Remove `frontmatterOptions` from MDX config
516
+
517
+ ### Patch Changes
518
+
519
+ - [#4205](https://github.com/withastro/astro/pull/4205) [`6c9736cbc`](https://github.com/withastro/astro/commit/6c9736cbc90162f1de3ebccd7cfe98332749b639) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Add frontmatter injection instructions to README
520
+
521
+ ## 0.7.0
522
+
523
+ ### Minor Changes
524
+
525
+ - [#4176](https://github.com/withastro/astro/pull/4176) [`2675b8633`](https://github.com/withastro/astro/commit/2675b8633c5d5c45b237ec87940d5eaf1bfb1b4b) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Support frontmatter injection for MD and MDX using remark and rehype plugins
526
+
527
+ ### Patch Changes
528
+
529
+ - [#4181](https://github.com/withastro/astro/pull/4181) [`77cede720`](https://github.com/withastro/astro/commit/77cede720b09bce34f29c3d2d8b505311ce876b1) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Make collect-headings rehype plugin non-overridable
530
+
531
+ * [#4174](https://github.com/withastro/astro/pull/4174) [`8eb3a8c6d`](https://github.com/withastro/astro/commit/8eb3a8c6d9554707963c3a3bc36ed8b68d3cf0fb) Thanks [@matthewp](https://github.com/matthewp)! - Allows using React with automatic imports alongside MDX
532
+
533
+ - [#4145](https://github.com/withastro/astro/pull/4145) [`c7efcf57e`](https://github.com/withastro/astro/commit/c7efcf57e00a0fcde3bc9f813e3cc59902bd484c) Thanks [@FredKSchott](https://github.com/FredKSchott)! - Fix a missing newline bug when `layout` was set.
534
+
535
+ ## 0.6.0
536
+
537
+ ### Minor Changes
538
+
539
+ - [#4134](https://github.com/withastro/astro/pull/4134) [`2968ba2b6`](https://github.com/withastro/astro/commit/2968ba2b6f00775b6e9872681b390cb466fdbfa2) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Add `headings` and `frontmatter` properties to layout props
540
+
541
+ ## 0.5.0
542
+
543
+ ### Minor Changes
544
+
545
+ - [#4095](https://github.com/withastro/astro/pull/4095) [`40ef43a59`](https://github.com/withastro/astro/commit/40ef43a59b08a1a8fbcd9f4a53745a9636a4fbb9) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Add IDs to MDX headings and expose via getHeadings() export
546
+
547
+ * [#4114](https://github.com/withastro/astro/pull/4114) [`64432bcb8`](https://github.com/withastro/astro/commit/64432bcb873efd0e4297c00fc9583a1fe516dfe7) Thanks [@Princesseuh](https://github.com/Princesseuh)! - Refactor `@astrojs/mdx` and `@astrojs/markdown-remark` to use `@astrojs/prism` instead of duplicating the code
548
+
549
+ ### Patch Changes
550
+
551
+ - [#4112](https://github.com/withastro/astro/pull/4112) [`e33fc9bc4`](https://github.com/withastro/astro/commit/e33fc9bc46ff0a30013deb6dc76e545e70cc3a3e) Thanks [@matthewp](https://github.com/matthewp)! - Fix MDX working with a ts config file
552
+
553
+ * [#4049](https://github.com/withastro/astro/pull/4049) [`b60cc0538`](https://github.com/withastro/astro/commit/b60cc0538bc5c68dd411117780d20d892530789d) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Improve `injectScript` handling for non-Astro pages
554
+
555
+ * Updated dependencies [[`64432bcb8`](https://github.com/withastro/astro/commit/64432bcb873efd0e4297c00fc9583a1fe516dfe7)]:
556
+ - @astrojs/prism@0.7.0
557
+
558
+ ## 0.4.0
559
+
560
+ ### Minor Changes
561
+
562
+ - [#4088](https://github.com/withastro/astro/pull/4088) [`1743fe140`](https://github.com/withastro/astro/commit/1743fe140eb58d60e26cbd11a066bb60de046e0c) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Support "layout" frontmatter property
563
+
564
+ ## 0.3.1
565
+
566
+ ### Patch Changes
567
+
568
+ - [#4076](https://github.com/withastro/astro/pull/4076) [`6120a71e5`](https://github.com/withastro/astro/commit/6120a71e5425ad55a17ddac800d64a3f50273bce) Thanks [@matthewp](https://github.com/matthewp)! - Ensure file and url are always present in MDX for Astro.glob
569
+
570
+ ## 0.3.0
571
+
572
+ ### Minor Changes
573
+
574
+ - [#3977](https://github.com/withastro/astro/pull/3977) [`19433eb4a`](https://github.com/withastro/astro/commit/19433eb4a4441522f68492ca914ad2ab4f061343) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Add remarkPlugins and rehypePlugins to config, with the same default plugins as our standard Markdown parser
575
+
576
+ * [#4002](https://github.com/withastro/astro/pull/4002) [`3b8a74452`](https://github.com/withastro/astro/commit/3b8a7445247221100462ba035f6778b43ea180e7) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Support Prism and Shiki syntax highlighting based on project config
577
+
578
+ - [#3995](https://github.com/withastro/astro/pull/3995) [`b2b367c96`](https://github.com/withastro/astro/commit/b2b367c969493aaf21c974064beb241d05228066) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Support YAML frontmatter in MDX files
579
+
580
+ ### Patch Changes
581
+
582
+ - [#4050](https://github.com/withastro/astro/pull/4050) [`9ab66c4ba`](https://github.com/withastro/astro/commit/9ab66c4ba9bf2250990114c76b792f26d0694365) Thanks [@FredKSchott](https://github.com/FredKSchott)! - Add support for injected "page-ssr" scripts
583
+
584
+ * [#3981](https://github.com/withastro/astro/pull/3981) [`61fec6304`](https://github.com/withastro/astro/commit/61fec63044e1585348e8405bee6fdf4dec635efa) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Include page url in MDX glob result
585
+
586
+ ## 0.2.1
587
+
588
+ ### Patch Changes
589
+
590
+ - [#3937](https://github.com/withastro/astro/pull/3937) [`31f9c0bf0`](https://github.com/withastro/astro/commit/31f9c0bf029ffa4b470e620f2c32e1370643e81e) Thanks [@delucis](https://github.com/delucis)! - Roll back supported Node engines
591
+
592
+ ## 0.2.0
593
+
594
+ ### Minor Changes
595
+
596
+ - [#3914](https://github.com/withastro/astro/pull/3914) [`b48767985`](https://github.com/withastro/astro/commit/b48767985359bd359df8071324952ea5f2bc0d86) Thanks [@ran-dall](https://github.com/ran-dall)! - Rollback supported `node@16` version. Minimum versions are now `node@14.20.0` or `node@16.14.0`.
597
+
598
+ ## 0.1.1
599
+
600
+ ### Patch Changes
601
+
602
+ - [#3885](https://github.com/withastro/astro/pull/3885) [`bf5d1cc1e`](https://github.com/withastro/astro/commit/bf5d1cc1e71da38a14658c615e9481f2145cc6e7) Thanks [@delucis](https://github.com/delucis)! - Integration README fixes
603
+
604
+ ## 0.1.0
605
+
606
+ ### Minor Changes
607
+
608
+ - [#3871](https://github.com/withastro/astro/pull/3871) [`1cc5b7890`](https://github.com/withastro/astro/commit/1cc5b78905633608e5b07ad291f916f54e67feb1) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Update supported `node` versions. Minimum versions are now `node@14.20.0` or `node@16.16.0`.
609
+
610
+ ## 0.0.3
611
+
612
+ ### Patch Changes
613
+
614
+ - [#3854](https://github.com/withastro/astro/pull/3854) [`b012ee55`](https://github.com/withastro/astro/commit/b012ee55b107dea0730286263b27d83e530fad5d) Thanks [@bholmesdev](https://github.com/bholmesdev)! - [astro add] Support adapters and third party packages
615
+
616
+ ## 0.0.2
617
+
618
+ ### Patch Changes
619
+
620
+ - [#3706](https://github.com/withastro/astro/pull/3706) [`032ad1c0`](https://github.com/withastro/astro/commit/032ad1c047a62dd663067cc562537d16f2872aa7) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Initial release! 🎉