-
#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, } });
-
#5741
000d3e694
Thanks @delucis! - Fix broken links in README -
Updated dependencies [
93e633922
]:- @astrojs/markdown-remark@2.0.0-beta.1
-
#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! π