@docusaurus/types 3.0.1 → 3.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/types",
3
- "version": "3.0.1",
3
+ "version": "3.1.1",
4
4
  "description": "Common types for Docusaurus packages.",
5
5
  "types": "./src/index.d.ts",
6
6
  "publishConfig": {
@@ -13,6 +13,7 @@
13
13
  },
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
+ "@mdx-js/mdx": "^3.0.0",
16
17
  "@types/history": "^4.7.11",
17
18
  "@types/react": "*",
18
19
  "commander": "^5.1.0",
@@ -26,5 +27,5 @@
26
27
  "react": "^18.0.0",
27
28
  "react-dom": "^18.0.0"
28
29
  },
29
- "gitHead": "29d816067fd0022d4ca3bd5fdc42098dac9f7ffc"
30
+ "gitHead": "8017f6a6776ba1bd7065e630a52fe2c2654e2f1b"
30
31
  }
package/src/config.d.ts CHANGED
@@ -10,6 +10,10 @@ import type {Required as RequireKeys, DeepPartial} from 'utility-types';
10
10
  import type {I18nConfig} from './i18n';
11
11
  import type {PluginConfig, PresetConfig, HtmlTagObject} from './plugin';
12
12
 
13
+ import type {ProcessorOptions} from '@mdx-js/mdx';
14
+
15
+ export type RemarkRehypeOptions = ProcessorOptions['remarkRehypeOptions'];
16
+
13
17
  export type ReportingSeverity = 'ignore' | 'log' | 'warn' | 'throw';
14
18
 
15
19
  export type ThemeConfig = {
@@ -27,6 +31,20 @@ export type MDX1CompatOptions = {
27
31
  headingIds: boolean;
28
32
  };
29
33
 
34
+ export type ParseFrontMatterParams = {filePath: string; fileContent: string};
35
+ export type ParseFrontMatterResult = {
36
+ frontMatter: {[key: string]: unknown};
37
+ content: string;
38
+ };
39
+ export type DefaultParseFrontMatter = (
40
+ params: ParseFrontMatterParams,
41
+ ) => Promise<ParseFrontMatterResult>;
42
+ export type ParseFrontMatter = (
43
+ params: ParseFrontMatterParams & {
44
+ defaultParseFrontMatter: DefaultParseFrontMatter;
45
+ },
46
+ ) => Promise<ParseFrontMatterResult>;
47
+
30
48
  export type MarkdownConfig = {
31
49
  /**
32
50
  * The Markdown format to use by default.
@@ -44,6 +62,14 @@ export type MarkdownConfig = {
44
62
  */
45
63
  format: 'mdx' | 'md' | 'detect';
46
64
 
65
+ /**
66
+ * A function callback that lets users parse the front matter themselves.
67
+ * Gives the opportunity to read it from a different source, or process it.
68
+ *
69
+ * @see https://github.com/facebook/docusaurus/issues/5568
70
+ */
71
+ parseFrontMatter: ParseFrontMatter;
72
+
47
73
  /**
48
74
  * Allow mermaid language code blocks to be rendered into Mermaid diagrams:
49
75
  *
@@ -69,6 +95,12 @@ export type MarkdownConfig = {
69
95
  * See also https://github.com/facebook/docusaurus/issues/4029
70
96
  */
71
97
  mdx1Compat: MDX1CompatOptions;
98
+
99
+ /**
100
+ * Ability to provide custom remark-rehype options
101
+ * See also https://github.com/remarkjs/remark-rehype#options
102
+ */
103
+ remarkRehypeOptions: RemarkRehypeOptions;
72
104
  };
73
105
 
74
106
  /**
@@ -143,6 +175,13 @@ export type DocusaurusConfig = {
143
175
  * @default "throw"
144
176
  */
145
177
  onBrokenLinks: ReportingSeverity;
178
+ /**
179
+ * The behavior of Docusaurus when it detects any broken link.
180
+ *
181
+ * @see https://docusaurus.io/docs/api/docusaurus-config#onBrokenAnchors
182
+ * @default "warn"
183
+ */
184
+ onBrokenAnchors: ReportingSeverity;
146
185
  /**
147
186
  * The behavior of Docusaurus when it detects any broken markdown link.
148
187
  *
package/src/index.d.ts CHANGED
@@ -9,6 +9,8 @@ export {
9
9
  ReportingSeverity,
10
10
  ThemeConfig,
11
11
  MarkdownConfig,
12
+ DefaultParseFrontMatter,
13
+ ParseFrontMatter,
12
14
  DocusaurusConfig,
13
15
  Config,
14
16
  } from './config';
package/src/routing.d.ts CHANGED
@@ -60,6 +60,11 @@ export type RouteConfig = {
60
60
  routes?: RouteConfig[];
61
61
  /** React router config option: `exact` routes would not match subroutes. */
62
62
  exact?: boolean;
63
+ /**
64
+ * React router config option: `strict` routes are sensitive to the presence
65
+ * of a trailing slash.
66
+ */
67
+ strict?: boolean;
63
68
  /** Used to sort routes. Higher-priority routes will be placed first. */
64
69
  priority?: number;
65
70
  /** Extra props; will be copied to routes.js. */