@docusaurus/types 3.2.1 → 3.3.2

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.2.1",
3
+ "version": "3.3.2",
4
4
  "description": "Common types for Docusaurus packages.",
5
5
  "types": "./src/index.d.ts",
6
6
  "publishConfig": {
@@ -27,5 +27,5 @@
27
27
  "react": "^18.0.0",
28
28
  "react-dom": "^18.0.0"
29
29
  },
30
- "gitHead": "f268e15264e208e6faf26117258162e988b53773"
30
+ "gitHead": "bc638d674bfbde1e254ef306697f47e764b5e107"
31
31
  }
package/src/config.d.ts CHANGED
@@ -45,6 +45,13 @@ export type ParseFrontMatter = (
45
45
  },
46
46
  ) => Promise<ParseFrontMatterResult>;
47
47
 
48
+ export type MarkdownAnchorsConfig = {
49
+ /**
50
+ * Preserves the case of the heading text when generating anchor ids.
51
+ */
52
+ maintainCase: boolean;
53
+ };
54
+
48
55
  export type MarkdownConfig = {
49
56
  /**
50
57
  * The Markdown format to use by default.
@@ -101,6 +108,11 @@ export type MarkdownConfig = {
101
108
  * See also https://github.com/remarkjs/remark-rehype#options
102
109
  */
103
110
  remarkRehypeOptions: RemarkRehypeOptions;
111
+
112
+ /**
113
+ * Options to control the behavior of anchors generated from Markdown headings
114
+ */
115
+ anchors: MarkdownAnchorsConfig;
104
116
  };
105
117
 
106
118
  /**
package/src/context.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  import type {DocusaurusConfig} from './config';
8
8
  import type {CodeTranslations, I18n} from './i18n';
9
9
  import type {LoadedPlugin, PluginVersionInformation} from './plugin';
10
- import type {RouteConfig} from './routing';
10
+ import type {PluginRouteConfig} from './routing';
11
11
 
12
12
  export type DocusaurusContext = {
13
13
  siteConfig: DocusaurusConfig;
@@ -57,7 +57,7 @@ export type Props = LoadContext & {
57
57
  preBodyTags: string;
58
58
  postBodyTags: string;
59
59
  siteMetadata: SiteMetadata;
60
- routes: RouteConfig[];
60
+ routes: PluginRouteConfig[];
61
61
  routesPaths: string[];
62
62
  plugins: LoadedPlugin[];
63
63
  };
package/src/index.d.ts CHANGED
@@ -70,6 +70,7 @@ export {
70
70
 
71
71
  export {
72
72
  RouteConfig,
73
+ PluginRouteConfig,
73
74
  RouteMetadata,
74
75
  RouteContext,
75
76
  PluginRouteContext,
package/src/plugin.d.ts CHANGED
@@ -49,7 +49,7 @@ export type PluginVersionInformation =
49
49
 
50
50
  export type PluginContentLoadedActions = {
51
51
  addRoute: (config: RouteConfig) => void;
52
- createData: (name: string, data: string) => Promise<string>;
52
+ createData: (name: string, data: string | object) => Promise<string>;
53
53
  setGlobalData: (data: unknown) => void;
54
54
  };
55
55
 
package/src/routing.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import type {ParsedUrlQueryInput} from 'querystring';
9
+ import type {PluginIdentifier} from './plugin';
9
10
 
10
11
  /**
11
12
  * A "module" represents a unit of serialized data emitted from the plugin. It
@@ -110,9 +111,23 @@ export type RouteConfig = {
110
111
  */
111
112
  metadata?: RouteMetadata;
112
113
  /**
113
- * Extra props; will be available on the client side.
114
+ * Optional props object; will be converted to a module and injected as props
115
+ * into the route component.
114
116
  */
115
- [propName: string]: unknown;
117
+ props?: {[propName: string]: unknown};
118
+ /**
119
+ * Extra route attribute; will be available on the client side route object.
120
+ */
121
+ [attributeName: string]: unknown;
122
+ };
123
+
124
+ export type PluginRouteConfig = RouteConfig & {
125
+ /**
126
+ * Routes are always created by Docusaurus plugins
127
+ * A plugin identifier is available at the top of a routing tree
128
+ * (child routes are implicitly created by the same plugin as their parent)
129
+ */
130
+ plugin: PluginIdentifier;
116
131
  };
117
132
 
118
133
  export type RouteContext = {