mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
a9c2920264
* feat: change extendDefaults -> gfm * deps: remove smartypants from md/remark * tests: update markdown plugin tests * fix: borked lockfile * feat: allow all Markdown options in MDX config, with extend * deps: remove smartypants from MDX * chore: remove unused `mode` property * chore: remark rehype types * chore: dead code * fix: order of default config properties * refactor: move md defaults to remark * fix: RemarkRehype type * fix: apply defaults based on MD defaults * chore: update plugin tests * chore: add syntaxHighlight test * refactor: remove drafts from config defaults * docs: new MDX config options * chore: add changeset * edit: test both extends for syntax highlight * refactor: remove MDX config deep merge * docs: update README and changeset * edit: avoid -> disable Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * edit: `drafts` clarification Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * edit: remove "scare quotes" Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * docs: MDX config options redraft * docs: add migration * chore: changeset heading levels * refactor: githubFlavoredMarkdown -> gfm * chore: remove unused imports Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
63 lines
2.6 KiB
Markdown
63 lines
2.6 KiB
Markdown
---
|
|
'astro': major
|
|
'@astrojs/markdown-remark': major
|
|
'@astrojs/mdx': minor
|
|
---
|
|
|
|
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 simplified `gfm` 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` or `rehypePlugins` are configured. If you want to apply custom plugins _and_ remove GFM, manually set `gfm: false` in your config.
|
|
|
|
#### MDX
|
|
|
|
- Support _all_ Markdown configuration options (except `drafts`) from your MDX integration config. This includes `syntaxHighlighting` and `shikiConfig` options to further customize the MDX renderer.
|
|
- 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.
|
|
|
|
#### Migration
|
|
|
|
To preserve your existing Markdown and MDX setup, you may need some configuration changes:
|
|
|
|
##### Smartypants manual installation
|
|
|
|
[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.*`:
|
|
|
|
```diff
|
|
// astro.config.mjs
|
|
import { defineConfig } from 'astro/config';
|
|
+ import smartypants from 'remark-smartypants';
|
|
|
|
export default defineConfig({
|
|
markdown: {
|
|
+ remarkPlugins: [smartypants],
|
|
}
|
|
});
|
|
```
|
|
|
|
##### Migrate `extendDefaultPlugins` to `gfm`
|
|
|
|
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`.
|
|
|
|
```diff
|
|
// 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 setting `gfm` to `false`.
|
|
|
|
##### Migrate MDX's `extendPlugins` to `extendMarkdownConfig`
|
|
|
|
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 the `extendPlugins: 'markdown'` option.
|
|
- `gfm` (`true` by default) to toggle GitHub-Flavored Markdown in MDX. This replaces the `extendPlugins: 'defaults'` option.
|