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:
Endi 2019-06-03 14:54:27 +07:00 committed by GitHub
parent 6a814ac64a
commit 8743ee5041
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 10 deletions

View file

@ -29,6 +29,9 @@ const DEFAULT_OPTIONS = {
blogPostComponent: '@theme/BlogPostPage',
blogTagsListComponent: '@theme/BlogTagsListPage',
blogTagsPostsComponent: '@theme/BlogTagsPostsPage',
remarkPlugins: [],
rehypePlugins: [],
prismTheme: '',
};
module.exports = function(context, opts) {
@ -341,6 +344,7 @@ module.exports = function(context, opts) {
},
configureWebpack(config, isServer, {getBabelLoader, getCacheLoader}) {
const {rehypePlugins, remarkPlugins, prismTheme} = options;
return {
module: {
rules: [
@ -350,7 +354,14 @@ module.exports = function(context, opts) {
use: [
getCacheLoader(isServer),
getBabelLoader(isServer),
'@docusaurus/mdx-loader',
{
loader: '@docusaurus/mdx-loader',
options: {
remarkPlugins,
rehypePlugins,
prismTheme,
},
},
{
loader: path.resolve(__dirname, './markdownLoader.js'),
},