Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
46 KiB
@astrojs/markdown-remark
2.1.0
Minor Changes
-
#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
Patch Changes
- Updated dependencies [
fec583909
,b087b83fe
,694918a56
,a20610609
,a4a74ab70
,75921b3cd
,afbbc4d5b
]:- astro@2.1.0
- @astrojs/prism@2.1.0
2.0.1
Patch Changes
-
#5978
7abb1e905
Thanks @HiDeoo! - Fix MDX heading IDs generation when using a frontmatter reference -
Updated dependencies [
b53e0717b
,60b32d585
,883e0cc29
,dabce6b8c
,aedf23f85
]:- astro@2.0.2
2.0.0
Major Changes
-
#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.
-
#5785
16107b6a1
Thanks @delucis! - Drop support for legacy Astro-flavored Markdown -
#5684
a9c292026
& #576993e633922
Thanks @bholmesdev! - Refine Markdown and MDX configuration options for ease-of-use.-
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.
-
-
#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 } })
-
#5806
7572f7402
Thanks @matthewp! - Make astro apeerDependency
of integrationsThis marks
astro
as apeerDependency
of several packages that are already gettingmajor
version bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with.
Patch Changes
-
#5837
12f65a4d5
Thanks @giuseppelt! - fix shiki css class replace logic -
Updated dependencies [
93e633922
,16dc36a87
,01f3f463b
,e2019be6f
,05caf445d
,49ab4f231
,a342a486c
,8fb28648f
,1f92d64ea
,c2180746b
,ae8a012a7
,cf2de5422
,ce5c5dbd4
,ec09bb664
,665a2c222
,259a539d7
,f7aa1ec25
,4987d6f44
,304823811
,302e0ef8f
,55cea0a9d
,dd56c1941
,9963c6e4d
,be901dc98
,f6cf92b48
,e818cc046
,8c100a6fe
,116d8835c
,840412128
,1f49cddf9
,7325df412
,16c7d0bfd
,a9c292026
,2a5786419
,4a1cabfe6
,a8d3e7924
,fa8c131f8
,64b8082e7
,c4b0cb8bf
,23dc9ea96
,63a6ceb38
,a3a7fc929
,52209ca2a
,5fd9208d4
,5eba34fcc
,899214298
,3a00ecb3e
,5eba34fcc
,2303f9514
,1ca81c16b
,b66d7195c
]:- astro@2.0.0
- @astrojs/prism@2.0.0
2.0.0-beta.2
See changes in 2.0.0-beta.2
Major Changes
-
#5785
16107b6a1
Thanks @delucis! - Drop support for legacy Astro-flavored Markdown -
#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 } })
-
#5806
7572f7402
Thanks @matthewp! - Make astro a peerDependency of integrationsThis marks
astro
as a peerDependency of several packages that are already gettingmajor
version bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with.
Patch Changes
-
#5837
12f65a4d5
Thanks @giuseppelt! - fix shiki css class replace logic -
Updated dependencies [
01f3f463b
,1f92d64ea
,c2180746b
,ae8a012a7
,cf2de5422
,ec09bb664
,665a2c222
,f7aa1ec25
,302e0ef8f
,840412128
,1f49cddf9
,4a1cabfe6
,c4b0cb8bf
,23dc9ea96
,63a6ceb38
,52209ca2a
,2303f9514
]:- astro@2.0.0-beta.2
- @astrojs/prism@2.0.0-beta.0
2.0.0-beta.1
See changes in 2.0.0-beta.1
Minor Changes
-
#5769
93e633922
Thanks @bholmesdev! - Introduce asmartypants
flag to opt-out of Astro's default SmartyPants plugin.{ markdown: { smartypants: false, } }
Migration
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, } });
2.0.0-beta.0
See changes in 2.0.0-beta.0
Major Changes
-
#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; }; }
Content Collections - new
remarkPluginFrontmatter
propertyWe 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.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.
-
#5684
a9c292026
Thanks @bholmesdev! - Refine Markdown and MDX configuration options for ease-of-use.Markdown
- 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.
MDX
- 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.
Migration
To preserve your existing Markdown and MDX setup, you may need some configuration changes:
Smartypants manual installation
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], } });
Migrate
extendDefaultPlugins
togfm
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
.Migrate MDX's
extendPlugins
toextendMarkdownConfig
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
1.2.0
Minor Changes
-
#5654
2c65b433b
Thanks @delucis! - Refactor and exportrehypeHeadingIds
pluginThe
rehypeHeadingIds
plugin injects IDs for all headings in a Markdown document and can now also handle MDX inputs if needed. You can import and use this plugin if you need heading IDs to be injected before other rehype plugins run.
Patch Changes
- #5648
853081d1c
Thanks @bholmesdev! - Prevent relative image paths insrc/content/
1.1.3
Patch Changes
-
#4842
812658ad2
Thanks @bluwy! - Fix non-hoisted remark/rehype plugin loading -
#4842
812658ad2
Thanks @bluwy! - Add missing dependencies, support strict dependency installation (e.g. pnpm)
1.1.2
Patch Changes
1.1.1
Patch Changes
1.1.0
Minor Changes
- #4474
ac0321824
Thanks @bholmesdev! - Add "extends" to markdown plugin config to preserve Astro defaults
1.1.0-next.0
Minor Changes
- #4474
ac0321824
Thanks @bholmesdev! - Add "extends" to markdown plugin config to preserve Astro defaults
1.0.0
Major Changes
-
04ad44563
- > Astro v1.0 is out! Read the official announcement post.No breaking changes. This package is now officially stable and compatible with
astro@1.0.0
!
Patch Changes
- Updated dependencies [
04ad44563
]:- @astrojs/prism@1.0.0
0.14.1
Patch Changes
- #4176
2675b8633
Thanks @bholmesdev! - Support frontmatter injection for MD and MDX using remark and rehype plugins
- #4137
471c6f784
Thanks @bholmesdev! - Speed up internal markdown builds with new vite-plugin markdown
- #4169
16034f0dd
Thanks @hippotastic! - Fix double-escaping of non-highlighted code blocks in Astro-flavored markdown
0.14.0
Minor Changes
- #4114
64432bcb8
Thanks @Princesseuh! - Refactor@astrojs/mdx
and@astrojs/markdown-remark
to use@astrojs/prism
instead of duplicating the code
Patch Changes
- Updated dependencies [
64432bcb8
]:- @astrojs/prism@0.7.0
0.13.0
Minor Changes
ba11b3399
Thanks @RafidMuhymin! - fixed generated slugs in markdown that ends with a dash
-
#4016
00fab4ce1
Thanks @bholmesdev! - The use of components and JSX expressions in Markdown are no longer supported by default.For long term support, migrate to the
@astrojs/mdx
integration for MDX support (including.mdx
pages!).Not ready to migrate to MDX? Add the legacy flag to your Astro config to re-enable the previous Markdown support.
// https://astro.build/config export default defineConfig({ legacy: { astroFlavoredMarkdown: true, }, });
- #4031
6e27a5fdc
Thanks @natemoo-re! - BREAKING Renamed Markdown utility functiongetHeaders()
togetHeadings()
.
Patch Changes
- #4008
399d7e269
Thanks @bholmesdev! - Avoid parsing JSX, components, and Astro islands when using "plain" md mode. This bringsmarkdown.mode: 'md'
in-line with our docs description.
0.12.0
Minor Changes
- #3924
07fb544da
Thanks @FredKSchott! - Remove unused ssr-utils file
Patch Changes
- Updated dependencies [
31f9c0bf0
]:- @astrojs/prism@0.6.1
0.11.7
Patch Changes
- #3919
01a55467d
Thanks @FredKSchott! - Add back missing ssr-utils.js file
0.11.6
Patch Changes
-
#3911
ca45c0c27
Thanks @JuanM04! - Don't throw when Shiki doesn't recognize a language -
Updated dependencies [
b48767985
]:- @astrojs/prism@0.6.0
0.11.5
Patch Changes
- #3669
93e1020b1
Thanks @natemoo-re! - Tooling: reintroduce smoke test across example projects
0.11.4
Patch Changes
- Updated dependencies [
1cc5b7890
]:- @astrojs/prism@0.5.0
0.11.3
Patch Changes
- #3638
80c71c7c
Thanks @tony-sull! - Fix: HTML comments in markdown code blocks should not be wrapped in JS comments
- #3612
fca58cfd
Thanks @bholmesdev! - Fix: "vpath" import error when building for netlify edge
- #3630
48e67fe0
Thanks @tony-sull! - Encodes ampersand characters in code blocks
- #3620
05aa7244
Thanks @hippotastic! - Remove extra newlines around Markdown components
0.11.2
Patch Changes
- #3572
5c73f614
Thanks @hippotastic! - Fix remarkMdxish performance issue on huge sites
0.11.1
Patch Changes
- #3564
76fb01cf
Thanks @hippotastic! - Fix autolinking of URLs inside links
- #3554
c549f161
Thanks @hippotastic! - Allow AlpineJS syntax extensions in Markdown
0.11.0
Minor Changes
Patch Changes
- #3514
6c955ca6
Thanks @hippotastic! - Fix Markdown errors missing source filename
- #3516
30578015
Thanks @hippotastic! - Fix: Allow self-closing tags in Markdown
0.10.2
Patch Changes
- #3486
119ecf8d
Thanks @hippotastic! - Fix components in markdown regressions
0.10.1
Patch Changes
- #3444
51db2b9b
Thanks @bholmesdev! - Fix: markdown imports failing due to internal dependency issue
0.10.0
Minor Changes
- #3410
cfae9760
Thanks @natemoo-re! - Significantally more stable behavior for "Markdown + Components" usage, which now handles component serialization much more similarly to MDX. Also supports switching between Components and Markdown without extra newlines, removes wrapping<p>
tags from standalone components, and improves JSX expression handling.
0.9.4
Patch Changes
0.9.3
Patch Changes
- #3234
de123b28
Thanks @JuanM04! - Removedrehype-slug
in favor of our own implementation. The behavior of the slugging should remain the same
0.9.2
Patch Changes
- #3152
9ba1f4f8
Thanks @bholmesdev! - Fix JSX expression inconsistencies within markdown files
0.9.1
Patch Changes
- #3108
ef198ff8
Thanks @FredKSchott! - shiki: Adddiff
symbol handling to disableuser-select
on+
/-
symbols.
0.9.0
Minor Changes
53162534
Thanks @FredKSchott! - - RemovedrenderMarkdownWithFrontmatter
because it wasn't being used- All options of
renderMarkdown
are now required — see the exported interfaceAstroMarkdownOptions
- New types: RemarkPlugin, RehypePlugin and ShikiConfig
- All options of
0.8.2
Patch Changes
0.8.1
Patch Changes
0.8.0
Minor Changes
e425f896
Thanks @FredKSchott! - Update config options to respect RFC0019
0.7.0
Minor Changes
- #2824
0a3d3e51
Thanks @bholmesdev! - Change shiki to our default markdown syntax highlighter. This includes updates to all relevant starter projects that used Prism-specific styles.
Patch Changes
-
#2870
d763ec18
Thanks @FredKSchott! - Fix a shiki performance issue affecting large sites -
Updated dependencies [
2db97f10
]:- @astrojs/prism@0.4.1
0.7.0-next.1
Patch Changes
-
#2870
d763ec18
Thanks @FredKSchott! - Fix a shiki performance issue affecting large sites -
Updated dependencies [
2db97f10
]:- @astrojs/prism@0.4.1-next.0
0.7.0-next.0
Minor Changes
- #2824
0a3d3e51
Thanks @bholmesdev! - Change shiki to our default markdown syntax highlighter. This includes updates to all relevant starter projects that used Prism-specific styles.
0.6.4
Patch Changes
0.6.3
Patch Changes
- #2697
91765d79
Thanks @FredKSchott! - Improve performance by optimizing calls togetHighlighter
0.6.2
Patch Changes
0.6.1
Patch Changes
- #2534
cfeaa941
Thanks @JuanM04! - Now you can use local plugins by passing a function instead of animport
- #2518
2bc91543
Thanks @JuanM04! - Added the ability to use custom themes and langs with Shiki (<Code />
and@astrojs/markdown-remark
)
0.6.1-next.2
Patch Changes
0.6.1-next.1
Patch Changes
- #2534
cfeaa941
Thanks @JuanM04! - Now you can use local plugins by passing a function instead of animport
- #2518
2bc91543
Thanks @JuanM04! - Added the ability to use custom themes and langs with Shiki (<Code />
and@astrojs/markdown-remark
)
0.6.1-next.0
Patch Changes
0.6.0
Minor Changes
- #2202
45cea6ae
Thanks @jonathantneal! - Officially drop support for Node v12. The minimum supported version is now Node v14.15+,
Patch Changes
- Updated dependencies [
45cea6ae
]:- @astrojs/prism@0.4.0
0.5.0
Minor Changes
679d4395
: - Upgraded dependencies- Replaced
remark-slug
withrehype-slug
because it was deprecated - Replaced
@silvenon/remark-smartypants
withremark-smartypants
because its name was changed - Disable all built-in plugins when custom remark and/or rehype plugins are added
- Removed
remark-footnotes
becauseremark-gfm
now supports footnotes - Re-added
remark-smartypants
andrehype-slug
to the default plugins list
- Replaced
0.4.0
Minor Changes
e6aaeff5
: Initial release.
Patch Changes
- Updated dependencies [
e6aaeff5
]- @astrojs/prism@0.3.0
0.4.0-next.2
Patch Changes
00d2b625
: Move gray-matter to deps
0.4.0-next.1
Patch Changes
7eaabbb0
: Fix bug where code blocks would not be escaped properly
0.4.0-next.0
Minor Changes
d84bfe71
: Adds prism support within the Markdown plugin.
Patch Changes
- Updated dependencies [
d84bfe71
]- @astrojs/prism@0.3.0-next.0
0.3.1
Patch Changes
b03f8771
: Fix parsing of an empty<pre></pre>
tag in markdown files, which expected the pre tag to have a childb03f8771
: Fix the importing ofunified
Plugin
andUnifiedPlugin
types
0.3.0
Minor Changes
397d8f3d
: Upgrade@astrojs/markdown-support
dependencies. Theremark-rehype@9
upgrade enables accessible footnotes withremark-footnotes
.
0.2.4
Patch Changes
a421329f
: Fix the left-brace issue
0.2.3
Patch Changes
460e625
: Move remaining missing dependencies
0.2.2
Patch Changes
7015356
: Move rehype-raw to a dependency
0.2.1
Patch Changes
70f0a09
: Added remark-slug to default plugins
0.2.0
Minor Changes
-
d396943
: Add support forremark
andrehype
plugins for both.md
pages and.astro
pages using the<Markdown>
component.For example, the
astro.config.mjs
could be updated to include the following. Read the Markdown documentation for more information.Note
Enabling custom
remarkPlugins
orrehypePlugins
removes Astro's built-in support for GitHub-flavored Markdown support, Footnotes syntax, Smartypants. You must explicitly add these plugins to yourastro.config.mjs
file, if desired.export default { markdownOptions: { remarkPlugins: ['remark-slug', ['remark-autolink-headings', { behavior: 'prepend' }]], rehypePlugins: ['rehype-slug', ['rehype-autolink-headings', { behavior: 'prepend' }]], }, };
Patch Changes
f83407e
: Exposehtml
toAstro.fetchContent
(#571)
0.1.2
Patch Changes
f9f2da4
: Add repository key to all package.json
0.1.1
Patch Changes
50e6f49
: Fixes issues with using astro via the create script