mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-18 11:36:53 +02:00
feat(v2): allow passing remark, rehype, prismtheme to mdx-loader (#1543)
* feat(v2): allow passing remark, rehype, prismtheme to mdx-loader * nits
This commit is contained in:
parent
6a814ac64a
commit
8743ee5041
7 changed files with 49 additions and 10 deletions
|
@ -25,9 +25,20 @@ module.exports = async function(fileString) {
|
|||
const callback = this.async();
|
||||
|
||||
const {data, content} = matter(fileString);
|
||||
const options = Object.assign(DEFAULT_OPTIONS, getOptions(this), {
|
||||
const reqOptions = getOptions(this) || {};
|
||||
const options = {
|
||||
...reqOptions,
|
||||
remarkPlugins: [
|
||||
...DEFAULT_OPTIONS.remarkPlugins,
|
||||
...(reqOptions.remarkPlugins || []),
|
||||
],
|
||||
rehypePlugins: [
|
||||
...DEFAULT_OPTIONS.rehypePlugins,
|
||||
...(reqOptions.rehypePlugins || []),
|
||||
],
|
||||
prismTheme: reqOptions.prismTheme || DEFAULT_OPTIONS.prismTheme,
|
||||
filepath: this.resourcePath,
|
||||
});
|
||||
};
|
||||
let result;
|
||||
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue