-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle MDX optimize for root hast node (#11975)
- Loading branch information
Showing
5 changed files
with
58 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/mdx': patch | ||
--- | ||
|
||
Handles nested root hast node when optimizing MDX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 34 additions & 6 deletions
40
packages/integrations/mdx/test/fixtures/mdx-optimize/astro.config.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,37 @@ | ||
import mdx from '@astrojs/mdx'; | ||
|
||
export default { | ||
integrations: [mdx({ | ||
optimize: { | ||
ignoreElementNames: ['strong'] | ||
} | ||
})] | ||
} | ||
integrations: [ | ||
mdx({ | ||
optimize: { | ||
ignoreElementNames: ['strong'], | ||
}, | ||
}), | ||
], | ||
markdown: { | ||
rehypePlugins: [ | ||
() => { | ||
return (tree) => { | ||
tree.children.push({ | ||
type: 'root', | ||
children: [ | ||
{ | ||
type: 'element', | ||
tagName: 'p', | ||
properties: { | ||
id: 'injected-root-hast', | ||
}, | ||
children: [ | ||
{ | ||
type: 'text', | ||
value: 'Injected root hast from rehype plugin', | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
}; | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.