@docusaurus/plugin-content-pages 2.0.0-beta.21 → 2.0.0-beta.22

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/index.js CHANGED
@@ -11,7 +11,6 @@ const tslib_1 = require("tslib");
11
11
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
12
  const path_1 = tslib_1.__importDefault(require("path"));
13
13
  const utils_1 = require("@docusaurus/utils");
14
- const remark_admonitions_1 = tslib_1.__importDefault(require("remark-admonitions"));
15
14
  const frontMatter_1 = require("./frontMatter");
16
15
  function getContentPathList(contentPaths) {
17
16
  return [contentPaths.contentPathLocalized, contentPaths.contentPath];
@@ -19,17 +18,11 @@ function getContentPathList(contentPaths) {
19
18
  exports.getContentPathList = getContentPathList;
20
19
  const isMarkdownSource = (source) => source.endsWith('.md') || source.endsWith('.mdx');
21
20
  function pluginContentPages(context, options) {
22
- if (options.admonitions) {
23
- options.remarkPlugins = options.remarkPlugins.concat([
24
- [remark_admonitions_1.default, options.admonitions],
25
- ]);
26
- }
27
- const { siteConfig, siteDir, generatedFilesDir, i18n: { currentLocale }, } = context;
21
+ const { siteConfig, siteDir, generatedFilesDir, localizationDir } = context;
28
22
  const contentPaths = {
29
23
  contentPath: path_1.default.resolve(siteDir, options.path),
30
24
  contentPathLocalized: (0, utils_1.getPluginI18nPath)({
31
- siteDir,
32
- locale: currentLocale,
25
+ localizationDir,
33
26
  pluginName: 'docusaurus-plugin-content-pages',
34
27
  pluginId: options.id,
35
28
  }),
@@ -117,7 +110,7 @@ function pluginContentPages(context, options) {
117
110
  }));
118
111
  },
119
112
  configureWebpack(config, isServer, { getJSLoader }) {
120
- const { rehypePlugins, remarkPlugins, beforeDefaultRehypePlugins, beforeDefaultRemarkPlugins, } = options;
113
+ const { admonitions, rehypePlugins, remarkPlugins, beforeDefaultRehypePlugins, beforeDefaultRemarkPlugins, } = options;
121
114
  const contentDirs = getContentPathList(contentPaths);
122
115
  return {
123
116
  resolve: {
@@ -137,6 +130,7 @@ function pluginContentPages(context, options) {
137
130
  {
138
131
  loader: require.resolve('@docusaurus/mdx-loader'),
139
132
  options: {
133
+ admonitions,
140
134
  remarkPlugins,
141
135
  rehypePlugins,
142
136
  beforeDefaultRehypePlugins,
package/lib/options.js CHANGED
@@ -19,7 +19,7 @@ exports.DEFAULT_OPTIONS = {
19
19
  rehypePlugins: [],
20
20
  beforeDefaultRehypePlugins: [],
21
21
  beforeDefaultRemarkPlugins: [],
22
- admonitions: {},
22
+ admonitions: true,
23
23
  };
24
24
  const PluginOptionSchema = utils_validation_1.Joi.object({
25
25
  path: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.path),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-pages",
3
- "version": "2.0.0-beta.21",
3
+ "version": "2.0.0-beta.22",
4
4
  "description": "Pages plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-content-pages.d.ts",
@@ -18,14 +18,14 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@docusaurus/core": "2.0.0-beta.21",
22
- "@docusaurus/mdx-loader": "2.0.0-beta.21",
23
- "@docusaurus/utils": "2.0.0-beta.21",
24
- "@docusaurus/utils-validation": "2.0.0-beta.21",
21
+ "@docusaurus/core": "2.0.0-beta.22",
22
+ "@docusaurus/mdx-loader": "2.0.0-beta.22",
23
+ "@docusaurus/types": "2.0.0-beta.22",
24
+ "@docusaurus/utils": "2.0.0-beta.22",
25
+ "@docusaurus/utils-validation": "2.0.0-beta.22",
25
26
  "fs-extra": "^10.1.0",
26
- "remark-admonitions": "^1.2.1",
27
27
  "tslib": "^2.4.0",
28
- "webpack": "^5.72.1"
28
+ "webpack": "^5.73.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@docusaurus/types": "2.0.0-beta.21"
@@ -37,5 +37,5 @@
37
37
  "engines": {
38
38
  "node": ">=16.14"
39
39
  },
40
- "gitHead": "69ac49fc6909517f13615ee40290c4bd00c39df4"
40
+ "gitHead": "daf9e462c4eebb7ac26a940932311f987e768f87"
41
41
  }
package/src/index.ts CHANGED
@@ -21,7 +21,6 @@ import {
21
21
  DEFAULT_PLUGIN_ID,
22
22
  parseMarkdownString,
23
23
  } from '@docusaurus/utils';
24
- import admonitions from 'remark-admonitions';
25
24
  import {validatePageFrontMatter} from './frontMatter';
26
25
 
27
26
  import type {LoadContext, Plugin} from '@docusaurus/types';
@@ -43,23 +42,12 @@ export default function pluginContentPages(
43
42
  context: LoadContext,
44
43
  options: PluginOptions,
45
44
  ): Plugin<LoadedContent | null> {
46
- if (options.admonitions) {
47
- options.remarkPlugins = options.remarkPlugins.concat([
48
- [admonitions, options.admonitions],
49
- ]);
50
- }
51
- const {
52
- siteConfig,
53
- siteDir,
54
- generatedFilesDir,
55
- i18n: {currentLocale},
56
- } = context;
45
+ const {siteConfig, siteDir, generatedFilesDir, localizationDir} = context;
57
46
 
58
47
  const contentPaths: PagesContentPaths = {
59
48
  contentPath: path.resolve(siteDir, options.path),
60
49
  contentPathLocalized: getPluginI18nPath({
61
- siteDir,
62
- locale: currentLocale,
50
+ localizationDir,
63
51
  pluginName: 'docusaurus-plugin-content-pages',
64
52
  pluginId: options.id,
65
53
  }),
@@ -176,6 +164,7 @@ export default function pluginContentPages(
176
164
 
177
165
  configureWebpack(config, isServer, {getJSLoader}) {
178
166
  const {
167
+ admonitions,
179
168
  rehypePlugins,
180
169
  remarkPlugins,
181
170
  beforeDefaultRehypePlugins,
@@ -200,6 +189,7 @@ export default function pluginContentPages(
200
189
  {
201
190
  loader: require.resolve('@docusaurus/mdx-loader'),
202
191
  options: {
192
+ admonitions,
203
193
  remarkPlugins,
204
194
  rehypePlugins,
205
195
  beforeDefaultRehypePlugins,
package/src/options.ts CHANGED
@@ -25,7 +25,7 @@ export const DEFAULT_OPTIONS: PluginOptions = {
25
25
  rehypePlugins: [],
26
26
  beforeDefaultRehypePlugins: [],
27
27
  beforeDefaultRemarkPlugins: [],
28
- admonitions: {},
28
+ admonitions: true,
29
29
  };
30
30
 
31
31
  const PluginOptionSchema = Joi.object<PluginOptions>({
@@ -16,7 +16,6 @@ declare module '@docusaurus/plugin-content-pages' {
16
16
  include: string[];
17
17
  exclude: string[];
18
18
  mdxPageComponent: string;
19
- admonitions: {[key: string]: unknown};
20
19
  };
21
20
 
22
21
  export type Options = Partial<PluginOptions>;
package/src/deps.d.ts DELETED
@@ -1,13 +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
- declare module 'remark-admonitions' {
9
- type Options = {[key: string]: unknown};
10
-
11
- const plugin: (options?: Options) => void;
12
- export = plugin;
13
- }