- #12245
1d4f6a4
Thanks @bmenant! - Addcomponents
property to MDXInstance type definition (RenderResult and module import)
- Updated dependencies [
710a1a1
]:- @astrojs/markdown-remark@5.3.0
- #11818
88ef1d0
Thanks @bluwy! - Fixes CSS in the layout component to be ordered first before any other components in the MDX file
- #11717
423614e
Thanks @bluwy! - Fixes stack trace location when failed to parse an MDX file with frontmatter
- Updated dependencies [
49b5145
]:- @astrojs/markdown-remark@5.2.0
- Updated dependencies [
b6afe6a
]:- @astrojs/markdown-remark@5.1.1
-
#11144
803dd80
Thanks @ematipico! - The integration now exposes a function calledgetContainerRenderer
, that can be used inside the Container APIs to load the relative renderer.import { experimental_AstroContainer as AstroContainer } from 'astro/container'; import ReactWrapper from '../src/components/ReactWrapper.astro'; import { loadRenderers } from 'astro:container'; import { getContainerRenderer } from '@astrojs/react'; test('ReactWrapper with react renderer', async () => { const renderers = await loadRenderers([getContainerRenderer()]); const container = await AstroContainer.create({ renderers, }); const result = await container.renderToString(ReactWrapper); expect(result).toContain('Counter'); expect(result).toContain('Count: <!-- -->5'); });
- #10813
3cc3e2c
Thanks @Xetera! - Omitting compiler-internal symbol from user components to fix breaking error messages
-
#10935
ddd8e49
Thanks @bluwy! - Refactors the MDX transformation to rely only on the unified pipeline. Babel and esbuild transformations are removed, which should result in faster build times. The refactor requires using Astro v4.8.0 but no other changes are necessary. -
#10935
ddd8e49
Thanks @bluwy! - Allows integrations after the MDX integration to updatemarkdown.remarkPlugins
andmarkdown.rehypePlugins
, and have the plugins work in MDX too.If your integration relies on Astro's previous behavior that prevents integrations from adding remark/rehype plugins for MDX, you will now need to configure
@astrojs/mdx
withextendMarkdownConfig: false
and explicitly specify anyremarkPlugins
andrehypePlugins
options instead. -
#10935
ddd8e49
Thanks @bluwy! - Renames theoptimize.customComponentNames
option tooptimize.ignoreElementNames
to better reflect its usecase. Its behaviour is not changed and should continue to work as before. -
#10935
ddd8e49
Thanks @bluwy! - Replaces the internalremark-images-to-component
plugin withrehype-images-to-component
to let users use additional rehype plugins for images
-
#10935
ddd8e49
Thanks @bluwy! - Simplifies plain MDX components as hast element nodes to further improve HTML string inlining for theoptimize
option -
#10935
ddd8e49
Thanks @bluwy! - Allows Vite plugins to transform.mdx
files before the MDX plugin transforms it -
#10935
ddd8e49
Thanks @bluwy! - Updates theoptimize
option to group static sibling nodes as a<Fragment />
. This reduces the number of AST nodes and simplifies runtime rendering of MDX pages. -
#10935
ddd8e49
Thanks @bluwy! - Tags the MDX component export for quicker component checks while rendering -
#10935
ddd8e49
Thanks @bluwy! - Fixesexport const components
keys detection for theoptimize
option -
#10935
ddd8e49
Thanks @bluwy! - Improvesoptimize
handling for MDX components with attributes and inline MDX components
-
#10754
3e7a12c8532411e580fcfdb8445cad8fc8499291
Thanks @rishi-raj-jain! - Fixes an issue where images in MDX required a relative specifier (e.g../
)Now, you can use the standard
![](img.png)
syntax in MDX files for images colocated in the same folder: no relative specifier required!There is no need to update your project; your existing images will still continue to work. However, you may wish to remove any relative specifiers from these MDX images as they are no longer necessary:
- ![A cute dog](./dog.jpg) + ![A cute dog](dog.jpg) <!-- This dog lives in the same folder as my article! -->
-
#10770
88ee63a3ba4488c60348cb821034e6d4a057efd0
Thanks @bluwy! - Removes internal MDX processor onbuildEnd
to free up memory
-
#10689
683d51a5eecafbbfbfed3910a3f1fbf0b3531b99
Thanks @ematipico! - Deprecate support for versions of Node.js older thanv18.17.1
for Node.js 18, older thanv20.0.3
for Node.js 20, and the complete Node.js v19 release line.This change is in line with Astro's Node.js support policy.
- Updated dependencies [
ccafa8d230f65c9302421a0ce0a0adc5824bfd55
]:- @astrojs/markdown-remark@5.1.0
- #10673
db7f9c87035a0de780536d95cdd9facff00c3c08
Thanks @bluwy! - Removes unnecessary internalrecmaInjectImportMetaEnv
plugin
- Updated dependencies [
2cf116f80cb5e421ab5cc5eb4a654e7b78c1b8de
,374efcdff9625ca43309d89e3b9cfc9174351512
]:- @astrojs/markdown-remark@5.0.0
- Updated dependencies [
c585528f446ccca3d4c643f4af5d550b93c18902
]:- @astrojs/markdown-remark@4.3.2
- Updated dependencies [
19e42c368184013fc30d1e46753b9e9383bb2bdf
]:- @astrojs/markdown-remark@4.3.1
-
#10104
a31bbd7ff8f3ec62ee507f72d1d25140b82ffc18
Thanks @remcohaszing! - Changes Astro's internal syntax highlighting to use rehype plugins instead of remark plugins. This provides better interoperability with other rehype plugins that deal with code blocks, in particular with third party syntax highlighting plugins andrehype-mermaid
.This may be a breaking change if you are currently using:
- a remark plugin that relies on nodes of type
html
- a rehype plugin that depends on nodes of type
raw
.
Please review your rendered code samples carefully, and if necessary, consider using a rehype plugin that deals with the generated
element
nodes instead. You can transform the AST of raw HTML strings, or alternatively usehast-util-to-html
to get a string from araw
node. - a remark plugin that relies on nodes of type
- Updated dependencies [
c081adf998d30419fed97d8fccc11340cdc512e0
,5a9528741fa98d017b269c7e4f013058028bdc5d
,a31bbd7ff8f3ec62ee507f72d1d25140b82ffc18
]:- @astrojs/markdown-remark@4.3.0
- Updated dependencies [
44c957f893c6bf5f5b7c78301de7b21c5975584d
]:- @astrojs/markdown-remark@4.2.1
- #9753
df37366556d46f7abdf82b09e33b08bd94e631b3
Thanks @OliverSpeir! - Allows remark plugins to pass options specifying how images in .mdx files will be optimized
- Updated dependencies [
53c69dcc82cdf4000aff13a6c11fffe19096cf45
,2f81cffa9da9db0e2802d303f94feaee8d2f54ec
,a505190933365268d48139a5f197a3cfb5570870
]:- @astrojs/markdown-remark@4.2.0
-
#9706
1539e04a8e5865027b3a8718c6f142885e7c8d88
Thanks @bluwy! - Removes redundant HMR handling code -
Updated dependencies [
165cfc154be477337037185c32b308616d1ed6fa
,e9a72d9a91a3741566866bcaab11172cb0dc7d31
]:- @astrojs/markdown-remark@4.1.0
- #9652
e72efd6a9a1e2a70488fd225529617ffd8418534
Thanks @bluwy! - Removes environment variables workaround that broke project builds with sourcemaps
- #9479
1baf0b0d3cbd0564954c2366a7278794fad6726e
Thanks @sarah11918! - Updates README
- #9452
e83b5095f
Thanks @florian-lefebvre! - Upgrades vite to latest
-
#9366
1b4e91898
Thanks @lilnasy! - Updates NPM package to refer to the stable Astro version instead of a beta. -
Updated dependencies [
270c6cc27
]:- @astrojs/markdown-remark@4.0.1
-
#9138
abf601233
Thanks @bluwy! - Updates the unified, remark, and rehype dependencies to latest. Make sure to update your custom remark and rehype plugins as well to be compatible with the latest versions.Potentially breaking change: The default value of
markdown.remarkRehype.footnoteBackLabel
is changed from"Back to content"
to"Back to reference 1"
. See themdast-util-to-hast
commit for more information.
-
#9138
abf601233
Thanks @bluwy! - Updates the unified, remark, and rehype dependencies to latest. Make sure to update your custom remark and rehype plugins as well to be compatible with the latest versions.Potentially breaking change: The default value of
markdown.remarkRehype.footnoteBackLabel
is changed from"Back to content"
to"Back to reference 1"
. See themdast-util-to-hast
commit for more information.
- Updated dependencies [
abf601233
,6201bbe96
,cdabf6ef0
,addb57c8e
,1c48ed286
,37697a2c5
,bd0c2e9ae
,c7953645e
,0fe3a7ed5
,710be505c
,153a5abb9
]:- @astrojs/markdown-remark@4.0.0-beta.0
- astro@4.0.0-beta.0
- Updated dependencies [
4537ecf0d
]:- @astrojs/markdown-remark@3.5.0
- Updated dependencies [
c5010aad3
]:- @astrojs/markdown-remark@3.4.0
-
#8897
5a3d46da1
Thanks @remcohaszing! - Update the README to suggest that users install the official MDX extension for VS Code. -
Updated dependencies [
26b77b8fe
]:- astro@3.3.4
- Updated dependencies [
2993055be
,c4270e476
,bd5aa1cd3
,f369fa250
,391729686
,f999365b8
,b2ae9ee0c
,0abff97fe
,3bef32f81
]:- astro@3.3.0
- @astrojs/markdown-remark@3.3.0
-
#8737
6f60da805
Thanks @ematipico! - Add provenance statement when publishing the library from CI -
Updated dependencies [
21f482657
,6f60da805
,d78806dfe
,d1c75fe15
,aa265d730
,78adbc443
,21e0757ea
,357270f2a
]:- @astrojs/markdown-remark@3.2.1
- astro@3.2.3
-
#8468
a8d72ceae
Thanks @bholmesdev! - Support theimg
component export for optimized images. This allows you to customize how optimized images are styled and rendered.When rendering an optimized image, Astro will pass the
ImageMetadata
object to yourimg
component as thesrc
prop. For unoptimized images (i.e. images using URLs or absolute paths), Astro will continue to pass thesrc
as a string.This example handles both cases and applies custom styling:
--- // src/components/MyImage.astro import type { ImageMetadata } from 'astro'; import { Image } from 'astro:assets'; type Props = { src: string | ImageMetadata; alt: string; }; const { src, alt } = Astro.props; --- { typeof src === 'string' ? ( <img class="custom-styles" src={src} alt={alt} /> ) : ( <Image class="custom-styles" {src} {alt} /> ) } <style> .custom-styles { border: 1px solid red; } </style>
Now, this components can be applied to the
img
component props object or file export:import MyImage from '../../components/MyImage.astro'; export const components = { img: MyImage }; # My MDX article
-
#8533
74dc3edb3
Thanks @bluwy! - Improve MDX rendering performance by sharing processor instance -
Updated dependencies [
7522bb491
,ecc65abbf
,2c4fc878b
,d93987824
,c92e0acd7
,7522bb491
,f95febf96
,b85c8a78a
,45364c345
]:- astro@3.1.0
- @astrojs/markdown-remark@3.2.0
-
#8430
f3f62a5a2
Thanks @bluwy! - Use exported remarkShiki and remarkPrism plugins from@astrojs/markdown-remark
-
Updated dependencies [
f3f62a5a2
,f66053a1e
,0fa483283
]:- @astrojs/markdown-remark@3.1.0
- astro@3.0.11
-
#8438
6df4f3bd9
Thanks @Princesseuh! - Fix errors not having a stacktrace -
Updated dependencies [
b3cf1b327
,b92d066b7
]:- astro@3.0.10
-
#8405
93a1231f1
Thanks @delucis! - Add location data to MDX compile errors -
Updated dependencies [
7d95bd9ba
,1947ef7a9
,61ad70fdc
,d2f2a11cd
,5126c6a40
,48ff7855b
,923a443cb
,8935b3b46
]:- astro@3.0.9
-
#8179
6011d52d3
Thanks @matthewp! - Astro 3.0 Release Candidate -
#8131
43140b87a
Thanks @matthewp! - Support Astro 3 JSX formatThis upgrades the MDX plugin to correctly work with the new JSX render API in Astro 3.
-
#8188
d0679a666
Thanks @ematipico! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023. -
#8169
e79e3779d
Thanks @bluwy! - Remove pre-shiki v0.14 theme names for compatibility. Please rename to the new theme names to migrate:material-darker
->material-theme-darker
material-default
->material-theme
material-lighter
->material-theme-lighter
material-ocean
->material-theme-ocean
material-palenight
->material-theme-palenight
-
#8188
84af8ed9d
Thanks @ematipico! - Addastro
as peer dependency
-
#8188
84af8ed9d
Thanks @ematipico! - Re-orders the MDX plugin to run before Astro's JSX plugin -
#8188
32669cd47
Thanks @ematipico! - Handlecomponents
exports handling itself -
Updated dependencies [
d0679a666
,db39206cb
,adf9fccfd
,0c7b42dc6
,46c4c0e05
,364d861bd
,2484dc408
,81545197a
,6011d52d3
,c2c71d90c
,cd2d7e769
,80f1494cd
,e45f30293
,c0de7a7b0
,65c354969
,3c3100851
,34cb20021
,a824863ab
,44f7a2872
,1048aca55
,be6bbd2c8
,9e021a91c
,7511a4980
,c37632a20
,acf652fc1
,42785c7b7
,8450379db
,dbc97b121
,7d2f311d4
,2540feedb
,ea7ff5177
,68efd4a8b
,7bd1b86f8
,036388f66
,519a1c4e8
,1f58a7a1b
,2ae9d37f0
,a8f35777e
,70f34f5a3
,5208a3c8f
,84af8ed9d
,f003e7364
,ffc9e2d3d
,732111cdc
,0f637c71e
,33b8910cf
,8a5b0c1f3
,148e61d24
,e79e3779d
,632579dc2
,3674584e0
,1db4e92c1
,e7f872e91
,16f09dfff
,4477bb41c
,55c10d1d5
,3e834293d
,96beb883a
,997a0db8a
,80f1494cd
,0f0625504
,e1ae56e72
,f32d093a2
,f01eb585e
,b76c166bd
,a87cbe400
,866ed4098
,767eb6866
,32669cd47
]:- @astrojs/prism@3.0.0
- astro@3.0.0
- @astrojs/markdown-remark@3.0.0
-
#8169
e79e3779d
Thanks @bluwy! - Remove pre-shiki v0.14 theme names for compatibility. Please rename to the new theme names to migrate:material-darker
->material-theme-darker
material-default
->material-theme
material-lighter
->material-theme-lighter
material-ocean
->material-theme-ocean
material-palenight
->material-theme-palenight
- Updated dependencies [
adf9fccfd
,582132328
,81545197a
,6011d52d3
,be6bbd2c8
,42785c7b7
,95120efbe
,2ae9d37f0
,f003e7364
,732111cdc
,33b8910cf
,e79e3779d
,179796405
,a87cbe400
,767eb6866
]:- astro@3.0.0-rc.5
- @astrojs/markdown-remark@3.0.0-rc.1
- @astrojs/prism@3.0.0-rc.1
-
#8131
43140b87a
Thanks @matthewp! - Support Astro 3 JSX formatThis upgrades the MDX plugin to correctly work with the new JSX render API in Astro 3.
- Updated dependencies [
2484dc408
,c2c71d90c
,7177f7579
,097a8e4e9
,dbc97b121
,2540feedb
,ea7ff5177
,68efd4a8b
,0e0fa605d
,5208a3c8f
,8a5b0c1f3
,d6b494376
,4477bb41c
,3e834293d
,b76c166bd
]:- astro@3.0.0-beta.3
-
1eae2e3f7
Thanks @Princesseuh! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023.
-
dfc2d93e3
Thanks @bluwy! - Re-orders the MDX plugin to run before Astro's JSX plugin -
631b9c410
Thanks @bluwy! - Handlecomponents
exports handling itself -
Updated dependencies [
1eae2e3f7
,76ddef19c
,9b4f70a62
,3fdf509b2
,2f951cd40
,c022a4217
,67becaa58
,bc37331d8
,dfc2d93e3
,3dc1ca2fa
,1be84dfee
,35f01df79
,3fdf509b2
,78de801f2
,59d6e569f
,7723c4cc9
,fb5cd6b56
,631b9c410
]:- @astrojs/prism@3.0.0-beta.0
- astro@3.0.0-beta.0
- @astrojs/markdown-remark@3.0.0-beta.0
- #7307
8034edd9e
Thanks @bholmesdev! - Fix [Object AsyncGenerator] appearing in markup for Markdoc documents
- #7185
339529fc8
Thanks @bholmesdev! - Bring back improved style and script handling across content collection files. This addresses bugs found in a previous release to@astrojs/markdoc
.
-
#7151
ea16570b1
Thanks @bluwy! - Addoptimize
option for faster builds and rendering -
#7192
7851f9258
Thanks @ematipico! - Detectmdx
files using their full extension -
#7191
27c6e0182
Thanks @bluwy! - Remove@mdx-js/rollup
dependency
- #7178
57e65d247
Thanks @bholmesdev! - Fix: revert Markdoc asset bleed changes. Production build issues were discovered that deserve a different fix.
- #6758
f558a9e20
Thanks @bholmesdev! - Improve style and script handling across content collection files. This addresses style bleed present in@astrojs/markdoc
v0.1.0
-
#7104
826e02890
Thanks @bluwy! - Specify"files"
field to only publish necessary files -
Updated dependencies [
826e02890
]:- @astrojs/markdown-remark@2.2.1
- @astrojs/prism@2.1.2
-
#6932
49514e4ce
Thanks @bluwy! - Upgrade shiki to v0.14.1. This updates the shiki theme colors and adds the theme name to thepre
tag, e.g.<pre class="astro-code github-dark">
. -
Updated dependencies [
49514e4ce
]:- @astrojs/markdown-remark@2.2.0
- #6824
2511d58d5
Thanks @Princesseuh! - Add support for using optimized and relative images in MDX files withexperimental.assets
- Updated dependencies [
2511d58d5
]:- @astrojs/markdown-remark@2.1.4
- #6817
f882bc163
Thanks @bholmesdev! - Fix sourcemap warnings when using Content Collections and MDX with thevite.build.sourcemap
option
-
#6552
392ba3e4d
Thanks @bluwy! - Fix integration return type -
Updated dependencies [
90e5f87d0
,f5fddafc2
]:- @astrojs/markdown-remark@2.1.1
-
#6494
a13e9d7e3
Thanks @Yan-Thomas! - Consistency improvements to several package descriptions -
Updated dependencies [
a13e9d7e3
]:- @astrojs/prism@2.1.1
-
#6344
694918a56
Thanks @Princesseuh! - Add a new experimental flag (experimental.assets
) to enable our new core Assets story.This unlocks a few features:
- A new built-in image component and JavaScript API to transform and optimize images.
- Relative images with automatic optimization in Markdown.
- Support for validating assets using content collections.
- and more!
See Assets (Experimental) on our docs site for more information on how to use this feature!
-
#6213
afbbc4d5b
Thanks @Princesseuh! - Updated compilation settings to disable downlevelling for Node 14
-
#6209
fec583909
Thanks @bholmesdev! - Introduce the (experimental)@astrojs/markdoc
integration. This unlocks Markdoc inside your Content Collections, bringing support for Astro and UI components in your content. This also improves Astro core internals to make Content Collections extensible to more file types in the future.You can install this integration using the
astro add
command:astro add markdoc
Read the
@astrojs/markdoc
documentation for usage instructions, and browse the newwith-markdoc
starter to try for yourself. -
Updated dependencies [
694918a56
,afbbc4d5b
]:- @astrojs/markdown-remark@2.1.0
- @astrojs/prism@2.1.0
- #6296
075b87e8b
Thanks @RaphaelBossek! - Update toes-module-lexer@1.1.1
- Updated to es-module-lexer@1.1.1
- #6253
0049fda62
Thanks @bluwy! - Support rehype plugins that inject namespaced attributes. This introduces a breaking change if you use custom components for HTML elements, where the prop passed to the component will be normal HTML casing, e.g.class
instead ofclassName
, andxlink:href
instead ofxlinkHref
.
- #6050
2ab32b59e
Thanks @bholmesdev! - Fix: load syntax highlighters after MDX remark plugins. This keeps MDX consistent with Astro's markdown behavior.
-
#5978
7abb1e905
Thanks @HiDeoo! - Fix MDX heading IDs generation when using a frontmatter reference -
Updated dependencies [
7abb1e905
]:- @astrojs/markdown-remark@2.0.1
-
#5684
a9c292026
Thanks @bholmesdev! - Refine Markdown and MDX configuration options for ease-of-use. & #576993e633922
Thanks @bholmesdev! - Introduce asmartypants
flag to opt-out of Astro's default SmartyPants plugin.-
Markdown
-
Replace the
extendDefaultPlugins
option with agfm
boolean and asmartypants
boolean. These are enabled by default, and can be disabled to remove GitHub-Flavored Markdown and SmartyPants. -
Ensure GitHub-Flavored Markdown and SmartyPants are applied whether or not custom
remarkPlugins
orrehypePlugins
are configured. If you want to apply custom plugins and remove Astro's default plugins, manually setgfm: false
andsmartypants: false
in your config.
-
-
Migrate
extendDefaultPlugins
togfm
andsmartypants
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:markdown.gfm
to disable GitHub-Flavored Markdownmarkdown.smartypants
to disable SmartyPants
// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { - extendDefaultPlugins: false, + smartypants: false, + gfm: false, } });
Additionally, applying remark and rehype plugins no longer disables
gfm
andsmartypants
. You will need to opt-out manually by settinggfm
andsmartypants
tofalse
. -
MDX
-
Support all Markdown configuration options (except
drafts
) from your MDX integration config. This includessyntaxHighlighting
andshikiConfig
options to further customize the MDX renderer. -
Simplify
extendPlugins
to anextendMarkdownConfig
option. MDX options will default to their equivalent in your Markdown config. By settingextendMarkdownConfig
to false, you can "eject" to set your own syntax highlighting, plugins, and more.
-
-
Migrate MDX's
extendPlugins
toextendMarkdownConfig
You may have used the
extendPlugins
option to manage plugin defaults in MDX. This has been replaced by 3 flags:extendMarkdownConfig
(true
by default) to toggle Markdown config inheritance. This replaces theextendPlugins: 'markdown'
option.gfm
(true
by default) andsmartypants
(true
by default) to toggle GitHub-Flavored Markdown and SmartyPants in MDX. This replaces theextendPlugins: 'defaults'
option.
-
-
#5687
e2019be6f
Thanks @bholmesdev! - Give remark and rehype plugins access to user frontmatter via frontmatter injection. This meansdata.astro.frontmatter
is now the complete Markdown or MDX document's frontmatter, rather than an empty object.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:export function remarkInjectSocialImagePlugin() { return function (tree, file) { const { frontmatter } = file.data.astro; frontmatter.socialImageSrc = new URL(frontmatter.imageSrc, 'https://my-blog.com/').pathname; }; }
When using Content Collections, you can access this modified frontmatter using the
remarkPluginFrontmatter
property returned when rendering an entry.Migration instructions
Plugin authors should now check for user frontmatter when applying defaults.
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:export function remarkInjectTitlePlugin() { return function (tree, file) { const { frontmatter } = file.data.astro; + if (!frontmatter.title) { frontmatter.title = 'Default title'; + } } }
This differs from previous behavior, where a Markdown file's frontmatter would always override frontmatter injected via remark or reype.
-
#5891
05caf445d
Thanks @bholmesdev! - Remove deprecated Markdown APIs from Astro v0.X. This includesgetHeaders()
, the.astro
property for layouts, and therawContent()
andcompiledContent()
error messages for MDX. -
#5782
1f92d64ea
Thanks @Princesseuh! - Remove support for Node 14. Minimum supported Node version is now >=16.12.0 -
#5825
52209ca2a
Thanks @bholmesdev! - Baseline the experimentalcontentCollections
flag. You're free to remove this from your astro config!import { defineConfig } from 'astro/config'; export default defineConfig({ - experimental: { contentCollections: true } })
-
#5837
12f65a4d5
Thanks @giuseppelt! - fix shiki css class replace logic -
#5741
000d3e694
Thanks @delucis! - Fix broken links in README -
Updated dependencies [
93e633922
,e2019be6f
,1f92d64ea
,12f65a4d5
,16107b6a1
,a9c292026
,52209ca2a
,7572f7402
]:- @astrojs/markdown-remark@2.0.0
- @astrojs/prism@2.0.0
See changes in 1.0.0-beta.2
-
#5825
52209ca2a
Thanks @bholmesdev! - Baseline the experimentalcontentCollections
flag. You're free to remove this from your astro config!import { defineConfig } from 'astro/config'; export default defineConfig({ - experimental: { contentCollections: true } })
- #5782
1f92d64ea
Thanks @Princesseuh! - Remove support for Node 14. Minimum supported Node version is now >=16.12.0
See changes in 0.15.0-beta.1
-
#5769
93e633922
Thanks @bholmesdev! - Introduce asmartypants
flag to opt-out of Astro's default SmartyPants plugin.{ markdown: { smartypants: false, } }
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:markdown.gfm
to disable GitHub-Flavored Markdownmarkdown.smartypants
to disable SmartyPants
// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { - extendDefaultPlugins: false, + smartypants: false, + gfm: false, } });
See changes in 0.15.0-beta.0
-
#5687
e2019be6f
Thanks @bholmesdev! - Give remark and rehype plugins access to user frontmatter via frontmatter injection. This meansdata.astro.frontmatter
is now the complete Markdown or MDX document's frontmatter, rather than an empty object.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:export function remarkInjectSocialImagePlugin() { return function (tree, file) { const { frontmatter } = file.data.astro; frontmatter.socialImageSrc = new URL(frontmatter.imageSrc, 'https://my-blog.com/').pathname; }; }
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.
To reflect this, the
injectedFrontmatter
property has been renamed toremarkPluginFrontmatter
. This should clarify this plugin is still separate from thedata
export Content Collections expose today.Plugin authors should now check for user frontmatter when applying defaults.
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:export function remarkInjectTitlePlugin() { return function (tree, file) { const { frontmatter } = file.data.astro; + if (!frontmatter.title) { frontmatter.title = 'Default title'; + } } }
This differs from previous behavior, where a Markdown file's frontmatter would always override frontmatter injected via remark or reype.
-
#5684
a9c292026
Thanks @bholmesdev! - Refine Markdown and MDX configuration options for ease-of-use.- Remove
remark-smartypants
from Astro's default Markdown plugins. - Replace the
extendDefaultPlugins
option with a simplifiedgfm
boolean. This is enabled by default, and can be disabled to remove GitHub-Flavored Markdown. - Ensure GitHub-Flavored Markdown is applied whether or not custom
remarkPlugins
orrehypePlugins
are configured. If you want to apply custom plugins and remove GFM, manually setgfm: false
in your config.
- Support all Markdown configuration options (except
drafts
) from your MDX integration config. This includessyntaxHighlighting
andshikiConfig
options to further customize the MDX renderer. - Simplify
extendDefaults
to anextendMarkdownConfig
option. MDX options will default to their equivalent in your Markdown config. By settingextendMarkdownConfig
to false, you can "eject" to set your own syntax highlighting, plugins, and more.
To preserve your existing Markdown and MDX setup, you may need some configuration changes:
Smartypants has been removed from Astro's default setup. If you rely on this plugin, install
remark-smartypants
and apply to yourastro.config.*
:// astro.config.mjs import { defineConfig } from 'astro/config'; + import smartypants from 'remark-smartypants'; export default defineConfig({ markdown: { + remarkPlugins: [smartypants], } });
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 togfm
.// astro.config.mjs import { defineConfig } from 'astro/config'; export default defineConfig({ markdown: { - extendDefaultPlugins: false, + gfm: false, } });
Additionally, applying remark and rehype plugins no longer disables
gfm
. You will need to opt-out manually by settinggfm
tofalse
.You may have used the
extendPlugins
option to manage plugin defaults in MDX. This has been replaced by 2 flags:extendMarkdownConfig
(true
by default) to toggle Markdown config inheritance. This replaces theextendPlugins: 'markdown'
option.gfm
(true
by default) to toggle GitHub-Flavored Markdown in MDX. This replaces theextendPlugins: 'defaults'
option.
- Remove
-
#5654
2c65b433b
Thanks @delucis! - Run heading ID injection after user plugins⚠️ BREAKING CHANGE⚠️ 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.
To inject IDs before your plugins run, import and add the
rehypeHeadingIds
plugin to yourrehypePlugins
config:// astro.config.mjs + import { rehypeHeadingIds } from '@astrojs/markdown-remark'; import mdx from '@astrojs/mdx'; export default { integrations: [mdx()], markdown: { rehypePlugins: [ + rehypeHeadingIds, otherPluginThatReliesOnHeadingIDs, ], }, }
-
#5667
a5ba4af79
Thanks @bholmesdev! - Chore: remove verbose "Now interiting Markdown plugins..." logs -
#5648
853081d1c
Thanks @bholmesdev! - Prevent relative image paths insrc/content/
-
Updated dependencies [
853081d1c
,2c65b433b
]:- @astrojs/markdown-remark@1.2.0
- #5291
5ec0f6ed5
Thanks @bholmesdev! - Introduce Content Collections experimental API- Organize your Markdown and MDX content into easy-to-manage collections.
- Add type safety to your frontmatter with schemas.
- Generate landing pages, static routes, and SSR endpoints from your content using the collection query APIs.
-
#5586
f4ff69a3c
Thanks @delucis! - Fix link in MDX integration README -
#5570
3f811eb68
Thanks @sarah11918! - Revise README
- #5522
efc4363e0
Thanks @delucis! - Support use of<Fragment>
in MDX files rendered with<Content />
component
- #5335
dca762cf7
Thanks @bluwy! - Preserve code element nodedata.meta
inproperties.metastring
for rehype syntax highlighters, like `rehype-pretty-code``
- #5146
308e565ad
Thanks @bholmesdev! - Support recmaPlugins config option
- #4842
812658ad2
Thanks @bluwy! - Add missing dependencies, support strict dependency installation (e.g. pnpm)
-
#4700
e5f71142e
Thanks @bholmesdev! - Document MDXLayoutProps utility type -
#4858
58a2dca22
Thanks @bholmesdev! - Correctly parse import.meta.env in MDX files
- #4588
db38f61b2
Thanks @bholmesdev! - Fix: Add GFM and Smartypants to MDX by default
- #4504
8f8dff4d3
Thanks @bholmesdev! - Introduce newextendPlugins
configuration option. This defaults to inheriting all remark and rehype plugins from yourmarkdown
config, with options to use either Astro's defaults or no inheritance at all.
-
#4519
a2e8e76c3
Thanks @JuanM04! - Upgraded Shiki to v0.11.1 -
#4530
8504cd79b
Thanks @kylebutts! - Add custom components to README
- #4423
d4cd7a59f
Thanks @bholmesdev! - Update Markdown type signature to match new markdown plugin,and update top-level layout props for better alignment
- #4423
d4cd7a59f
Thanks @bholmesdev! - Update Markdown type signature to match new markdown plugin,and update top-level layout props for better alignment
- #4443
adb207979
Thanks @bholmesdev! - Fix MDX style imports when layout is not applied
- #4428
a2414bf59
Thanks @bholmesdev! - Fix dev server reload performance when globbing from an MDX layout
- #4292
f1a52c18a
Thanks @bholmesdev! - Switch from Shiki Twoslash to Astro's Shiki Markdown highlighter
- #4268
f7afdb889
Thanks @bholmesdev! - Align MD with MDX on layout props and "glob" import results:- Add
Content
to MDX - Add
file
andurl
to MDX frontmatter (layout import only) - Update glob types to reflect differences (lack of
rawContent
andcompiledContent
)
- Add
- #4272
24d2f7a6e
Thanks @natemoo-re! - Properly handle hydration for namespaced components
- #4248
869d00935
Thanks @svemat01! - Load builtin rehype plugins before user plugins instead of after
-
#4255
411612808
Thanks @bholmesdev! - Pass injected frontmatter from remark and rehype plugins to layouts -
Updated dependencies [
1f0dd31d9
]:- @astrojs/prism@1.0.1
- #4237
9d5ab5508
Thanks @bholmesdev! - Update "Astro.props.content" -> "Astro.props.frontmatter" in README
- Updated dependencies [
04ad44563
]:- @astrojs/prism@1.0.0
- #4204
4c2ca5352
Thanks @bholmesdev! - RemovefrontmatterOptions
from MDX config
- #4205
6c9736cbc
Thanks @bholmesdev! - Add frontmatter injection instructions to README
- #4176
2675b8633
Thanks @bholmesdev! - Support frontmatter injection for MD and MDX using remark and rehype plugins
- #4181
77cede720
Thanks @bholmesdev! - Make collect-headings rehype plugin non-overridable
- #4145
c7efcf57e
Thanks @FredKSchott! - Fix a missing newline bug whenlayout
was set.
- #4134
2968ba2b6
Thanks @bholmesdev! - Addheadings
andfrontmatter
properties to layout props
- #4095
40ef43a59
Thanks @bholmesdev! - Add IDs to MDX headings and expose via getHeadings() export
- #4114
64432bcb8
Thanks @Princesseuh! - Refactor@astrojs/mdx
and@astrojs/markdown-remark
to use@astrojs/prism
instead of duplicating the code
-
#4049
b60cc0538
Thanks @natemoo-re! - ImproveinjectScript
handling for non-Astro pages -
Updated dependencies [
64432bcb8
]:- @astrojs/prism@0.7.0
- #4088
1743fe140
Thanks @bholmesdev! - Support "layout" frontmatter property
- #3977
19433eb4a
Thanks @bholmesdev! - Add remarkPlugins and rehypePlugins to config, with the same default plugins as our standard Markdown parser
- #4002
3b8a74452
Thanks @bholmesdev! - Support Prism and Shiki syntax highlighting based on project config
- #3995
b2b367c96
Thanks @bholmesdev! - Support YAML frontmatter in MDX files
- #4050
9ab66c4ba
Thanks @FredKSchott! - Add support for injected "page-ssr" scripts
- #3981
61fec6304
Thanks @bholmesdev! - Include page url in MDX glob result
- #3914
b48767985
Thanks @ran-dall! - Rollback supportednode@16
version. Minimum versions are nownode@14.20.0
ornode@16.14.0
.
- #3871
1cc5b7890
Thanks @natemoo-re! - Update supportednode
versions. Minimum versions are nownode@14.20.0
ornode@16.16.0
.
- #3854
b012ee55
Thanks @bholmesdev! - [astro add] Support adapters and third party packages
- #3706
032ad1c0
Thanks @natemoo-re! - Initial release! 🎉