@docusaurus/plugin-content-pages 3.3.2 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/content.d.ts +0 -1
- package/lib/content.js +3 -4
- package/lib/frontMatter.d.ts +0 -1
- package/lib/frontMatter.js +1 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.js +32 -36
- package/lib/options.d.ts +0 -1
- package/lib/options.js +4 -2
- package/lib/routes.d.ts +0 -1
- package/lib/routes.js +2 -3
- package/package.json +7 -7
- package/src/index.ts +41 -46
- package/src/options.ts +3 -0
- package/lib/markdownLoader.d.ts +0 -8
- package/lib/markdownLoader.js +0 -16
- package/src/markdownLoader.ts +0 -22
package/lib/content.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
/// <reference path="../src/plugin-content-pages.d.ts" />
|
|
8
7
|
import type { LoadContext } from '@docusaurus/types';
|
|
9
8
|
import type { PagesContentPaths } from './types';
|
|
10
9
|
import type { PluginOptions, LoadedContent } from '@docusaurus/plugin-content-pages';
|
package/lib/content.js
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.createPagesContentPaths = createPagesContentPaths;
|
|
10
|
+
exports.getContentPathList = getContentPathList;
|
|
11
|
+
exports.loadPagesContent = loadPagesContent;
|
|
10
12
|
const tslib_1 = require("tslib");
|
|
11
13
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
14
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -23,11 +25,9 @@ function createPagesContentPaths({ context, options, }) {
|
|
|
23
25
|
}),
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
|
-
exports.createPagesContentPaths = createPagesContentPaths;
|
|
27
28
|
function getContentPathList(contentPaths) {
|
|
28
29
|
return [contentPaths.contentPathLocalized, contentPaths.contentPath];
|
|
29
30
|
}
|
|
30
|
-
exports.getContentPathList = getContentPathList;
|
|
31
31
|
const isMarkdownSource = (source) => source.endsWith('.md') || source.endsWith('.mdx');
|
|
32
32
|
async function loadPagesContent(params) {
|
|
33
33
|
const { options } = params;
|
|
@@ -47,7 +47,6 @@ async function loadPagesContent(params) {
|
|
|
47
47
|
return res !== undefined;
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
exports.loadPagesContent = loadPagesContent;
|
|
51
50
|
async function processPageSourceFile(relativeSource, params) {
|
|
52
51
|
const { context, options, contentPaths } = params;
|
|
53
52
|
const { siteConfig, baseUrl, siteDir, i18n } = context;
|
package/lib/frontMatter.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
/// <reference path="../src/plugin-content-pages.d.ts" />
|
|
8
7
|
import type { PageFrontMatter } from '@docusaurus/plugin-content-pages';
|
|
9
8
|
export declare function validatePageFrontMatter(frontMatter: {
|
|
10
9
|
[key: string]: unknown;
|
package/lib/frontMatter.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.validatePageFrontMatter =
|
|
9
|
+
exports.validatePageFrontMatter = validatePageFrontMatter;
|
|
10
10
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
11
11
|
const PageFrontMatterSchema = utils_validation_1.Joi.object({
|
|
12
12
|
// See https://github.com/facebook/docusaurus/issues/4591#issuecomment-822372398
|
|
@@ -23,4 +23,3 @@ const PageFrontMatterSchema = utils_validation_1.Joi.object({
|
|
|
23
23
|
function validatePageFrontMatter(frontMatter) {
|
|
24
24
|
return (0, utils_validation_1.validateFrontMatter)(frontMatter, PageFrontMatterSchema);
|
|
25
25
|
}
|
|
26
|
-
exports.validatePageFrontMatter = validatePageFrontMatter;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
/// <reference path="../src/plugin-content-pages.d.ts" />
|
|
8
7
|
import type { LoadContext, Plugin } from '@docusaurus/types';
|
|
9
8
|
import type { PluginOptions, LoadedContent } from '@docusaurus/plugin-content-pages';
|
|
10
9
|
export default function pluginContentPages(context: LoadContext, options: PluginOptions): Plugin<LoadedContent | null>;
|
package/lib/index.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.validateOptions = void 0;
|
|
10
|
+
exports.default = pluginContentPages;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
13
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -37,8 +38,37 @@ function pluginContentPages(context, options) {
|
|
|
37
38
|
await (0, routes_1.createAllRoutes)({ content, options, actions });
|
|
38
39
|
},
|
|
39
40
|
configureWebpack() {
|
|
40
|
-
const { admonitions, rehypePlugins, remarkPlugins, beforeDefaultRehypePlugins, beforeDefaultRemarkPlugins, } = options;
|
|
41
|
+
const { admonitions, rehypePlugins, remarkPlugins, recmaPlugins, beforeDefaultRehypePlugins, beforeDefaultRemarkPlugins, } = options;
|
|
41
42
|
const contentDirs = (0, content_1.getContentPathList)(contentPaths);
|
|
43
|
+
function createMDXLoader() {
|
|
44
|
+
const loaderOptions = {
|
|
45
|
+
admonitions,
|
|
46
|
+
remarkPlugins,
|
|
47
|
+
rehypePlugins,
|
|
48
|
+
recmaPlugins,
|
|
49
|
+
beforeDefaultRehypePlugins,
|
|
50
|
+
beforeDefaultRemarkPlugins,
|
|
51
|
+
staticDirs: siteConfig.staticDirectories.map((dir) => path_1.default.resolve(siteDir, dir)),
|
|
52
|
+
siteDir,
|
|
53
|
+
isMDXPartial: (0, utils_1.createAbsoluteFilePathMatcher)(options.exclude, contentDirs),
|
|
54
|
+
metadataPath: (mdxPath) => {
|
|
55
|
+
// Note that metadataPath must be the same/in-sync as
|
|
56
|
+
// the path from createData for each MDX.
|
|
57
|
+
const aliasedSource = (0, utils_1.aliasedSitePath)(mdxPath, siteDir);
|
|
58
|
+
return path_1.default.join(dataDir, `${(0, utils_1.docuHash)(aliasedSource)}.json`);
|
|
59
|
+
},
|
|
60
|
+
// Assets allow to convert some relative images paths to
|
|
61
|
+
// require(...) calls
|
|
62
|
+
createAssets: ({ frontMatter }) => ({
|
|
63
|
+
image: frontMatter.image,
|
|
64
|
+
}),
|
|
65
|
+
markdownConfig: siteConfig.markdown,
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
loader: require.resolve('@docusaurus/mdx-loader'),
|
|
69
|
+
options: loaderOptions,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
42
72
|
return {
|
|
43
73
|
module: {
|
|
44
74
|
rules: [
|
|
@@ -47,40 +77,7 @@ function pluginContentPages(context, options) {
|
|
|
47
77
|
include: contentDirs
|
|
48
78
|
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
|
|
49
79
|
.map(utils_1.addTrailingPathSeparator),
|
|
50
|
-
use: [
|
|
51
|
-
{
|
|
52
|
-
loader: require.resolve('@docusaurus/mdx-loader'),
|
|
53
|
-
options: {
|
|
54
|
-
admonitions,
|
|
55
|
-
remarkPlugins,
|
|
56
|
-
rehypePlugins,
|
|
57
|
-
beforeDefaultRehypePlugins,
|
|
58
|
-
beforeDefaultRemarkPlugins,
|
|
59
|
-
staticDirs: siteConfig.staticDirectories.map((dir) => path_1.default.resolve(siteDir, dir)),
|
|
60
|
-
siteDir,
|
|
61
|
-
isMDXPartial: (0, utils_1.createAbsoluteFilePathMatcher)(options.exclude, contentDirs),
|
|
62
|
-
metadataPath: (mdxPath) => {
|
|
63
|
-
// Note that metadataPath must be the same/in-sync as
|
|
64
|
-
// the path from createData for each MDX.
|
|
65
|
-
const aliasedSource = (0, utils_1.aliasedSitePath)(mdxPath, siteDir);
|
|
66
|
-
return path_1.default.join(dataDir, `${(0, utils_1.docuHash)(aliasedSource)}.json`);
|
|
67
|
-
},
|
|
68
|
-
// Assets allow to convert some relative images paths to
|
|
69
|
-
// require(...) calls
|
|
70
|
-
createAssets: ({ frontMatter, }) => ({
|
|
71
|
-
image: frontMatter.image,
|
|
72
|
-
}),
|
|
73
|
-
markdownConfig: siteConfig.markdown,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
loader: path_1.default.resolve(__dirname, './markdownLoader.js'),
|
|
78
|
-
options: {
|
|
79
|
-
// siteDir,
|
|
80
|
-
// contentPath,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
].filter(Boolean),
|
|
80
|
+
use: [createMDXLoader()],
|
|
84
81
|
},
|
|
85
82
|
],
|
|
86
83
|
},
|
|
@@ -88,6 +85,5 @@ function pluginContentPages(context, options) {
|
|
|
88
85
|
},
|
|
89
86
|
};
|
|
90
87
|
}
|
|
91
|
-
exports.default = pluginContentPages;
|
|
92
88
|
var options_1 = require("./options");
|
|
93
89
|
Object.defineProperty(exports, "validateOptions", { enumerable: true, get: function () { return options_1.validateOptions; } });
|
package/lib/options.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
/// <reference path="../src/plugin-content-pages.d.ts" />
|
|
8
7
|
import type { OptionValidationContext } from '@docusaurus/types';
|
|
9
8
|
import type { PluginOptions, Options } from '@docusaurus/plugin-content-pages';
|
|
10
9
|
export declare const DEFAULT_OPTIONS: PluginOptions;
|
package/lib/options.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.DEFAULT_OPTIONS = void 0;
|
|
10
|
+
exports.validateOptions = validateOptions;
|
|
10
11
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
11
12
|
const utils_1 = require("@docusaurus/utils");
|
|
12
13
|
exports.DEFAULT_OPTIONS = {
|
|
@@ -17,6 +18,7 @@ exports.DEFAULT_OPTIONS = {
|
|
|
17
18
|
mdxPageComponent: '@theme/MDXPage',
|
|
18
19
|
remarkPlugins: [],
|
|
19
20
|
rehypePlugins: [],
|
|
21
|
+
recmaPlugins: [],
|
|
20
22
|
beforeDefaultRehypePlugins: [],
|
|
21
23
|
beforeDefaultRemarkPlugins: [],
|
|
22
24
|
admonitions: true,
|
|
@@ -32,6 +34,7 @@ const PluginOptionSchema = utils_validation_1.Joi.object({
|
|
|
32
34
|
mdxPageComponent: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.mdxPageComponent),
|
|
33
35
|
remarkPlugins: utils_validation_1.RemarkPluginsSchema.default(exports.DEFAULT_OPTIONS.remarkPlugins),
|
|
34
36
|
rehypePlugins: utils_validation_1.RehypePluginsSchema.default(exports.DEFAULT_OPTIONS.rehypePlugins),
|
|
37
|
+
recmaPlugins: utils_validation_1.RecmaPluginsSchema.default(exports.DEFAULT_OPTIONS.recmaPlugins),
|
|
35
38
|
beforeDefaultRehypePlugins: utils_validation_1.RehypePluginsSchema.default(exports.DEFAULT_OPTIONS.beforeDefaultRehypePlugins),
|
|
36
39
|
beforeDefaultRemarkPlugins: utils_validation_1.RemarkPluginsSchema.default(exports.DEFAULT_OPTIONS.beforeDefaultRemarkPlugins),
|
|
37
40
|
admonitions: utils_validation_1.AdmonitionsSchema.default(exports.DEFAULT_OPTIONS.admonitions),
|
|
@@ -44,4 +47,3 @@ function validateOptions({ validate, options, }) {
|
|
|
44
47
|
const validatedOptions = validate(PluginOptionSchema, options);
|
|
45
48
|
return validatedOptions;
|
|
46
49
|
}
|
|
47
|
-
exports.validateOptions = validateOptions;
|
package/lib/routes.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
/// <reference path="../src/plugin-content-pages.d.ts" />
|
|
8
7
|
import type { PluginContentLoadedActions, RouteConfig } from '@docusaurus/types';
|
|
9
8
|
import type { PluginOptions, LoadedContent } from '@docusaurus/plugin-content-pages';
|
|
10
9
|
type CreateAllRoutesParam = {
|
package/lib/routes.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.createAllRoutes = createAllRoutes;
|
|
10
|
+
exports.buildAllRoutes = buildAllRoutes;
|
|
10
11
|
const utils_1 = require("@docusaurus/utils");
|
|
11
12
|
function createPageRouteMetadata(metadata) {
|
|
12
13
|
const lastUpdatedAt = metadata.type === 'mdx' ? metadata.lastUpdatedAt : undefined;
|
|
@@ -19,7 +20,6 @@ async function createAllRoutes(param) {
|
|
|
19
20
|
const routes = await buildAllRoutes(param);
|
|
20
21
|
routes.forEach(param.actions.addRoute);
|
|
21
22
|
}
|
|
22
|
-
exports.createAllRoutes = createAllRoutes;
|
|
23
23
|
async function buildAllRoutes({ content, actions, options, }) {
|
|
24
24
|
const { createData } = actions;
|
|
25
25
|
async function buildMDXPageRoute(metadata) {
|
|
@@ -55,4 +55,3 @@ async function buildAllRoutes({ content, actions, options, }) {
|
|
|
55
55
|
}
|
|
56
56
|
return Promise.all(content.map(buildPageRoute));
|
|
57
57
|
}
|
|
58
|
-
exports.buildAllRoutes = buildAllRoutes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-pages",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Pages plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-pages.d.ts",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "3.
|
|
22
|
-
"@docusaurus/mdx-loader": "3.
|
|
23
|
-
"@docusaurus/types": "3.
|
|
24
|
-
"@docusaurus/utils": "3.
|
|
25
|
-
"@docusaurus/utils-validation": "3.
|
|
21
|
+
"@docusaurus/core": "3.5.0",
|
|
22
|
+
"@docusaurus/mdx-loader": "3.5.0",
|
|
23
|
+
"@docusaurus/types": "3.5.0",
|
|
24
|
+
"@docusaurus/utils": "3.5.0",
|
|
25
|
+
"@docusaurus/utils-validation": "3.5.0",
|
|
26
26
|
"fs-extra": "^11.1.1",
|
|
27
27
|
"tslib": "^2.6.0",
|
|
28
28
|
"webpack": "^5.88.1"
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "cb5829f3c34b26d798b869e38ee25073488140bd"
|
|
38
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,8 @@ import type {
|
|
|
26
26
|
LoadedContent,
|
|
27
27
|
PageFrontMatter,
|
|
28
28
|
} from '@docusaurus/plugin-content-pages';
|
|
29
|
+
import type {RuleSetUseItem} from 'webpack';
|
|
30
|
+
import type {Options as MDXLoaderOptions} from '@docusaurus/mdx-loader/lib/loader';
|
|
29
31
|
|
|
30
32
|
export default function pluginContentPages(
|
|
31
33
|
context: LoadContext,
|
|
@@ -70,10 +72,48 @@ export default function pluginContentPages(
|
|
|
70
72
|
admonitions,
|
|
71
73
|
rehypePlugins,
|
|
72
74
|
remarkPlugins,
|
|
75
|
+
recmaPlugins,
|
|
73
76
|
beforeDefaultRehypePlugins,
|
|
74
77
|
beforeDefaultRemarkPlugins,
|
|
75
78
|
} = options;
|
|
76
79
|
const contentDirs = getContentPathList(contentPaths);
|
|
80
|
+
|
|
81
|
+
function createMDXLoader(): RuleSetUseItem {
|
|
82
|
+
const loaderOptions: MDXLoaderOptions = {
|
|
83
|
+
admonitions,
|
|
84
|
+
remarkPlugins,
|
|
85
|
+
rehypePlugins,
|
|
86
|
+
recmaPlugins,
|
|
87
|
+
beforeDefaultRehypePlugins,
|
|
88
|
+
beforeDefaultRemarkPlugins,
|
|
89
|
+
staticDirs: siteConfig.staticDirectories.map((dir) =>
|
|
90
|
+
path.resolve(siteDir, dir),
|
|
91
|
+
),
|
|
92
|
+
siteDir,
|
|
93
|
+
isMDXPartial: createAbsoluteFilePathMatcher(
|
|
94
|
+
options.exclude,
|
|
95
|
+
contentDirs,
|
|
96
|
+
),
|
|
97
|
+
metadataPath: (mdxPath: string) => {
|
|
98
|
+
// Note that metadataPath must be the same/in-sync as
|
|
99
|
+
// the path from createData for each MDX.
|
|
100
|
+
const aliasedSource = aliasedSitePath(mdxPath, siteDir);
|
|
101
|
+
return path.join(dataDir, `${docuHash(aliasedSource)}.json`);
|
|
102
|
+
},
|
|
103
|
+
// Assets allow to convert some relative images paths to
|
|
104
|
+
// require(...) calls
|
|
105
|
+
createAssets: ({frontMatter}: {frontMatter: PageFrontMatter}) => ({
|
|
106
|
+
image: frontMatter.image,
|
|
107
|
+
}),
|
|
108
|
+
markdownConfig: siteConfig.markdown,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
loader: require.resolve('@docusaurus/mdx-loader'),
|
|
113
|
+
options: loaderOptions,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
77
117
|
return {
|
|
78
118
|
module: {
|
|
79
119
|
rules: [
|
|
@@ -82,52 +122,7 @@ export default function pluginContentPages(
|
|
|
82
122
|
include: contentDirs
|
|
83
123
|
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
|
|
84
124
|
.map(addTrailingPathSeparator),
|
|
85
|
-
use: [
|
|
86
|
-
{
|
|
87
|
-
loader: require.resolve('@docusaurus/mdx-loader'),
|
|
88
|
-
options: {
|
|
89
|
-
admonitions,
|
|
90
|
-
remarkPlugins,
|
|
91
|
-
rehypePlugins,
|
|
92
|
-
beforeDefaultRehypePlugins,
|
|
93
|
-
beforeDefaultRemarkPlugins,
|
|
94
|
-
staticDirs: siteConfig.staticDirectories.map((dir) =>
|
|
95
|
-
path.resolve(siteDir, dir),
|
|
96
|
-
),
|
|
97
|
-
siteDir,
|
|
98
|
-
isMDXPartial: createAbsoluteFilePathMatcher(
|
|
99
|
-
options.exclude,
|
|
100
|
-
contentDirs,
|
|
101
|
-
),
|
|
102
|
-
metadataPath: (mdxPath: string) => {
|
|
103
|
-
// Note that metadataPath must be the same/in-sync as
|
|
104
|
-
// the path from createData for each MDX.
|
|
105
|
-
const aliasedSource = aliasedSitePath(mdxPath, siteDir);
|
|
106
|
-
return path.join(
|
|
107
|
-
dataDir,
|
|
108
|
-
`${docuHash(aliasedSource)}.json`,
|
|
109
|
-
);
|
|
110
|
-
},
|
|
111
|
-
// Assets allow to convert some relative images paths to
|
|
112
|
-
// require(...) calls
|
|
113
|
-
createAssets: ({
|
|
114
|
-
frontMatter,
|
|
115
|
-
}: {
|
|
116
|
-
frontMatter: PageFrontMatter;
|
|
117
|
-
}) => ({
|
|
118
|
-
image: frontMatter.image,
|
|
119
|
-
}),
|
|
120
|
-
markdownConfig: siteConfig.markdown,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
loader: path.resolve(__dirname, './markdownLoader.js'),
|
|
125
|
-
options: {
|
|
126
|
-
// siteDir,
|
|
127
|
-
// contentPath,
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
].filter(Boolean),
|
|
125
|
+
use: [createMDXLoader()],
|
|
131
126
|
},
|
|
132
127
|
],
|
|
133
128
|
},
|
package/src/options.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
Joi,
|
|
10
10
|
RemarkPluginsSchema,
|
|
11
11
|
RehypePluginsSchema,
|
|
12
|
+
RecmaPluginsSchema,
|
|
12
13
|
AdmonitionsSchema,
|
|
13
14
|
RouteBasePathSchema,
|
|
14
15
|
URISchema,
|
|
@@ -25,6 +26,7 @@ export const DEFAULT_OPTIONS: PluginOptions = {
|
|
|
25
26
|
mdxPageComponent: '@theme/MDXPage',
|
|
26
27
|
remarkPlugins: [],
|
|
27
28
|
rehypePlugins: [],
|
|
29
|
+
recmaPlugins: [],
|
|
28
30
|
beforeDefaultRehypePlugins: [],
|
|
29
31
|
beforeDefaultRemarkPlugins: [],
|
|
30
32
|
admonitions: true,
|
|
@@ -41,6 +43,7 @@ const PluginOptionSchema = Joi.object<PluginOptions>({
|
|
|
41
43
|
mdxPageComponent: Joi.string().default(DEFAULT_OPTIONS.mdxPageComponent),
|
|
42
44
|
remarkPlugins: RemarkPluginsSchema.default(DEFAULT_OPTIONS.remarkPlugins),
|
|
43
45
|
rehypePlugins: RehypePluginsSchema.default(DEFAULT_OPTIONS.rehypePlugins),
|
|
46
|
+
recmaPlugins: RecmaPluginsSchema.default(DEFAULT_OPTIONS.recmaPlugins),
|
|
44
47
|
beforeDefaultRehypePlugins: RehypePluginsSchema.default(
|
|
45
48
|
DEFAULT_OPTIONS.beforeDefaultRehypePlugins,
|
|
46
49
|
),
|
package/lib/markdownLoader.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import type { LoaderContext } from 'webpack';
|
|
8
|
-
export default function markdownLoader(this: LoaderContext<undefined>, fileString: string): void;
|
package/lib/markdownLoader.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
function markdownLoader(fileString) {
|
|
10
|
-
const callback = this.async();
|
|
11
|
-
// const options = this.getOptions();
|
|
12
|
-
// TODO provide additional md processing here? like interlinking pages?
|
|
13
|
-
// fileString = linkify(fileString)
|
|
14
|
-
return callback(null, fileString);
|
|
15
|
-
}
|
|
16
|
-
exports.default = markdownLoader;
|
package/src/markdownLoader.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type {LoaderContext} from 'webpack';
|
|
9
|
-
|
|
10
|
-
export default function markdownLoader(
|
|
11
|
-
this: LoaderContext<undefined>,
|
|
12
|
-
fileString: string,
|
|
13
|
-
): void {
|
|
14
|
-
const callback = this.async();
|
|
15
|
-
|
|
16
|
-
// const options = this.getOptions();
|
|
17
|
-
|
|
18
|
-
// TODO provide additional md processing here? like interlinking pages?
|
|
19
|
-
// fileString = linkify(fileString)
|
|
20
|
-
|
|
21
|
-
return callback(null, fileString);
|
|
22
|
-
}
|