diff --git a/examples/basic-react-site/dist/index.html b/examples/basic-react-site/dist/index.html
index 9a5bac4..224f476 100644
--- a/examples/basic-react-site/dist/index.html
+++ b/examples/basic-react-site/dist/index.html
@@ -4,7 +4,7 @@
Flatwave React Example
-
+
diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json
index c50f86a..dbdd3df 100644
--- a/node_modules/.package-lock.json
+++ b/node_modules/.package-lock.json
@@ -1,6 +1,6 @@
{
- "name": "vite-plugin-flatwave-react-workspace",
- "version": "1.0.0",
+ "name": "vite-plugin-flatwave-react",
+ "version": "2.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
@@ -13,7 +13,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-helmet-async": "^2.0.0",
- "react-markdown": "^9.0.3",
+ "react-markdown": "^10.0.0",
"react-router-dom": "^6.0.0"
},
"devDependencies": {
@@ -5962,6 +5962,7 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-4.0.0.tgz",
"integrity": "sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==",
+ "deprecated": "This package is no longer maintained. For the JavaScript API, please use @conventional-changelog/git-client instead.",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -11693,9 +11694,9 @@
"license": "MIT"
},
"node_modules/react-markdown": {
- "version": "9.1.0",
- "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-9.1.0.tgz",
- "integrity": "sha512-xaijuJB0kzGiUdG7nc2MOMDUDBWPyGAjZtUrow9XxUeua8IqeP+VlIfAZ3bphpcLTnSZXz6z9jcVC/TCwbfgdw==",
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz",
+ "integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==",
"license": "MIT",
"dependencies": {
"@types/hast": "^3.0.0",
@@ -14627,7 +14628,7 @@
},
"packages/vite-plugin-flatwave-react": {
"name": "@kamansoft/vite-plugin-flatwave-react",
- "version": "1.0.0",
+ "version": "2.0.1",
"license": "MIT",
"dependencies": {
"commander": "^13.1.0",
@@ -14667,34 +14668,6 @@
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0"
}
},
- "packages/vite-plugin-flatwave-react/node_modules/react-markdown": {
- "version": "10.1.0",
- "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz",
- "integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@types/hast": "^3.0.0",
- "@types/mdast": "^4.0.0",
- "devlop": "^1.0.0",
- "hast-util-to-jsx-runtime": "^2.0.0",
- "html-url-attributes": "^3.0.0",
- "mdast-util-to-hast": "^13.0.0",
- "remark-parse": "^11.0.0",
- "remark-rehype": "^11.0.0",
- "unified": "^11.0.0",
- "unist-util-visit": "^5.0.0",
- "vfile": "^6.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- },
- "peerDependencies": {
- "@types/react": ">=18",
- "react": ">=18"
- }
- },
"packages/vite-plugin-flatwave-react/node_modules/vite": {
"version": "6.4.3",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz",
diff --git a/node_modules/react-markdown/index.d.ts b/node_modules/react-markdown/index.d.ts
index 8ccbbf0..80fe5f3 100644
--- a/node_modules/react-markdown/index.d.ts
+++ b/node_modules/react-markdown/index.d.ts
@@ -1,6 +1,7 @@
export type AllowElement = import("./lib/index.js").AllowElement;
export type Components = import("./lib/index.js").Components;
export type ExtraProps = import("./lib/index.js").ExtraProps;
+export type HooksOptions = import("./lib/index.js").HooksOptions;
export type Options = import("./lib/index.js").Options;
export type UrlTransform = import("./lib/index.js").UrlTransform;
export { MarkdownAsync, MarkdownHooks, Markdown as default, defaultUrlTransform } from "./lib/index.js";
diff --git a/node_modules/react-markdown/index.d.ts.map b/node_modules/react-markdown/index.d.ts.map
index 774ec64..1041dba 100644
--- a/node_modules/react-markdown/index.d.ts.map
+++ b/node_modules/react-markdown/index.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"2BACa,OAAO,gBAAgB,EAAE,YAAY;yBACrC,OAAO,gBAAgB,EAAE,UAAU;yBACnC,OAAO,gBAAgB,EAAE,UAAU;sBACnC,OAAO,gBAAgB,EAAE,OAAO;2BAChC,OAAO,gBAAgB,EAAE,YAAY"}
\ No newline at end of file
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"2BACa,OAAO,gBAAgB,EAAE,YAAY;yBACrC,OAAO,gBAAgB,EAAE,UAAU;yBACnC,OAAO,gBAAgB,EAAE,UAAU;2BACnC,OAAO,gBAAgB,EAAE,YAAY;sBACrC,OAAO,gBAAgB,EAAE,OAAO;2BAChC,OAAO,gBAAgB,EAAE,YAAY"}
\ No newline at end of file
diff --git a/node_modules/react-markdown/index.js b/node_modules/react-markdown/index.js
index 629aec0..d0fc80e 100644
--- a/node_modules/react-markdown/index.js
+++ b/node_modules/react-markdown/index.js
@@ -2,6 +2,7 @@
* @typedef {import('./lib/index.js').AllowElement} AllowElement
* @typedef {import('./lib/index.js').Components} Components
* @typedef {import('./lib/index.js').ExtraProps} ExtraProps
+ * @typedef {import('./lib/index.js').HooksOptions} HooksOptions
* @typedef {import('./lib/index.js').Options} Options
* @typedef {import('./lib/index.js').UrlTransform} UrlTransform
*/
diff --git a/node_modules/react-markdown/lib/index.d.ts b/node_modules/react-markdown/lib/index.d.ts
index dbb6a9c..f7ae6b7 100644
--- a/node_modules/react-markdown/lib/index.d.ts
+++ b/node_modules/react-markdown/lib/index.d.ts
@@ -33,12 +33,12 @@ export function MarkdownAsync(options: Readonly): Promise
* For async support on the server,
* see {@linkcode MarkdownAsync}.
*
- * @param {Readonly} options
+ * @param {Readonly} options
* Props.
- * @returns {ReactElement}
- * React element.
+ * @returns {ReactNode}
+ * React node.
*/
-export function MarkdownHooks(options: Readonly): ReactElement;
+export function MarkdownHooks(options: Readonly): ReactNode;
/**
* Make a URL safe.
*
@@ -65,7 +65,7 @@ export type ExtraProps = {
/**
* Map tag names to components.
*/
-export type Components = { [Key in Extract]?: ElementType & ExtraProps>; };
+export type Components = { [Key in keyof JSX.IntrinsicElements]?: ComponentType | keyof JSX.IntrinsicElements; };
/**
* Deprecation.
*/
@@ -101,10 +101,6 @@ export type Options = {
* Markdown.
*/
children?: string | null | undefined;
- /**
- * Wrap in a `div` with this class name.
- */
- className?: string | null | undefined;
/**
* Map tag names to components.
*/
@@ -141,15 +137,30 @@ export type Options = {
*/
urlTransform?: UrlTransform | null | undefined;
};
+/**
+ * Configuration specifically for {@linkcode MarkdownHooks}.
+ */
+export type HooksOptionsOnly = {
+ /**
+ * Content to render while the processor processing the markdown (optional).
+ */
+ fallback?: ReactNode | null | undefined;
+};
+/**
+ * Configuration for {@linkcode MarkdownHooks};
+ * extends the regular {@linkcode Options} with a `fallback` prop.
+ */
+export type HooksOptions = Options & HooksOptionsOnly;
/**
* Transform all URLs.
*/
export type UrlTransform = (url: string, key: string, node: Readonly) => string | null | undefined;
import type { ReactElement } from 'react';
+import type { ReactNode } from 'react';
import type { Element } from 'hast';
import type { Parents } from 'hast';
-import type { ElementType } from 'react';
-import type { ComponentProps } from 'react';
+import type { JSX } from 'react';
+import type { ComponentType } from 'react';
import type { PluggableList } from 'unified';
import type { Options as RemarkRehypeOptions } from 'remark-rehype';
//# sourceMappingURL=index.d.ts.map
\ No newline at end of file
diff --git a/node_modules/react-markdown/lib/index.d.ts.map b/node_modules/react-markdown/lib/index.d.ts.map
index 541d60f..fbe89d0 100644
--- a/node_modules/react-markdown/lib/index.d.ts.map
+++ b/node_modules/react-markdown/lib/index.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAsJA;;;;;;;;;;;GAWG;AACH,kCALW,QAAQ,CAAC,OAAO,CAAC,GAEf,YAAY,CAOxB;AAED;;;;;;;;;;;;GAYG;AACH,uCALW,QAAQ,CAAC,OAAO,CAAC,GAEf,OAAO,CAAC,YAAY,CAAC,CAQjC;AAED;;;;;;;;;;;;GAYG;AACH,uCALW,QAAQ,CAAC,OAAO,CAAC,GAEf,YAAY,CAgCxB;AAgLD;;;;;;;;GAQG;AACH,2CALW,MAAM,GAEJ,MAAM,CA0BlB;;;;qCA1aU,QAAQ,CAAC,OAAO,CAAC,SAEjB,MAAM,UAEN,QAAQ,CAAC,OAAO,CAAC,GAAG,SAAS,KAE3B,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;;;WAOzB,OAAO,GAAG,SAAS;;;;;yBAKpB,GACP,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,YAAY,eAAe,GAAG,CAAC,GAAG,UAAU,CAAC,GACtF;;;;;;;;UAOU,MAAM;;;;QAEN,MAAM;;;;SAEN,MAAM,OAAO;;;;;;;;;;mBAOb,YAAY,GAAG,IAAI,GAAG,SAAS;;;;;sBAG/B,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS;;;;eAGxC,MAAM,GAAG,IAAI,GAAG,SAAS;;;;gBAEzB,MAAM,GAAG,IAAI,GAAG,SAAS;;;;iBAEzB,UAAU,GAAG,IAAI,GAAG,SAAS;;;;;yBAE7B,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS;;;;oBAGxC,aAAa,GAAG,IAAI,GAAG,SAAS;;;;oBAEhC,aAAa,GAAG,IAAI,GAAG,SAAS;;;;0BAEhC,QAAQ,CAAC,mBAAmB,CAAC,GAAG,IAAI,GAAG,SAAS;;;;eAEhD,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;uBAE1B,OAAO,GAAG,IAAI,GAAG,SAAS;;;;mBAI1B,YAAY,GAAG,IAAI,GAAG,SAAS;;;;;iCAOlC,MAAM,OAEN,MAAM,QAEN,QAAQ,CAAC,OAAO,CAAC,KAEf,MAAM,GAAG,IAAI,GAAG,SAAS;kCAvFsB,OAAO;6BAFH,MAAM;6BAAN,MAAM;iCAEV,OAAO;oCAAP,OAAO;mCAGxB,SAAS;oDAFH,eAAe"}
\ No newline at end of file
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAkKA;;;;;;;;;;;GAWG;AACH,kCALW,QAAQ,CAAC,OAAO,CAAC,GAEf,YAAY,CAOxB;AAED;;;;;;;;;;;;GAYG;AACH,uCALW,QAAQ,CAAC,OAAO,CAAC,GAEf,OAAO,CAAC,YAAY,CAAC,CAQjC;AAED;;;;;;;;;;;;GAYG;AACH,uCALW,QAAQ,CAAC,YAAY,CAAC,GAEpB,SAAS,CAyCrB;AAgKD;;;;;;;;GAQG;AACH,2CALW,MAAM,GAEJ,MAAM,CA0BlB;;;;qCA/aU,QAAQ,CAAC,OAAO,CAAC,SAEjB,MAAM,UAEN,QAAQ,CAAC,OAAO,CAAC,GAAG,SAAS,KAE3B,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;;;WAOzB,OAAO,GAAG,SAAS;;;;;yBAKpB,GACP,GAAG,IAAI,MAAM,qBAAqB,CAAC,CAAC,EAAE,cAAc,qBAAqB,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,MAAM,qBAAqB,GAC5H;;;;;;;;UAOU,MAAM;;;;QAEN,MAAM;;;;SAEN,MAAM,OAAO;;;;;;;;;;mBAOb,YAAY,GAAG,IAAI,GAAG,SAAS;;;;;sBAG/B,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS;;;;eAGxC,MAAM,GAAG,IAAI,GAAG,SAAS;;;;iBAEzB,UAAU,GAAG,IAAI,GAAG,SAAS;;;;;yBAE7B,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS;;;;oBAGxC,aAAa,GAAG,IAAI,GAAG,SAAS;;;;oBAEhC,aAAa,GAAG,IAAI,GAAG,SAAS;;;;0BAEhC,QAAQ,CAAC,mBAAmB,CAAC,GAAG,IAAI,GAAG,SAAS;;;;eAEhD,OAAO,GAAG,IAAI,GAAG,SAAS;;;;;;uBAE1B,OAAO,GAAG,IAAI,GAAG,SAAS;;;;mBAI1B,YAAY,GAAG,IAAI,GAAG,SAAS;;;;;;;;;eAO/B,SAAS,GAAG,IAAI,GAAG,SAAS;;;;;;2BAK7B,OAAO,GAAG,gBAAgB;;;;iCAQ5B,MAAM,OAEN,MAAM,QAEN,QAAQ,CAAC,OAAO,CAAC,KAEf,MAAM,GAAG,IAAI,GAAG,SAAS;kCAlGwB,OAAO;+BAAP,OAAO;6BAFrB,MAAM;6BAAN,MAAM;yBAEQ,OAAO;mCAAP,OAAO;mCAG1B,SAAS;oDAFH,eAAe"}
\ No newline at end of file
diff --git a/node_modules/react-markdown/lib/index.js b/node_modules/react-markdown/lib/index.js
index c88a5a0..b6f5ed0 100644
--- a/node_modules/react-markdown/lib/index.js
+++ b/node_modules/react-markdown/lib/index.js
@@ -1,7 +1,7 @@
/**
- * @import {Element, ElementContent, Nodes, Parents, Root} from 'hast'
+ * @import {Element, Nodes, Parents, Root} from 'hast'
* @import {Root as MdastRoot} from 'mdast'
- * @import {ComponentProps, ElementType, ReactElement} from 'react'
+ * @import {ComponentType, JSX, ReactElement, ReactNode} from 'react'
* @import {Options as RemarkRehypeOptions} from 'remark-rehype'
* @import {BuildVisitor} from 'unist-util-visit'
* @import {PluggableList, Processor} from 'unified'
@@ -29,7 +29,7 @@
/**
* @typedef {{
- * [Key in Extract]?: ElementType & ExtraProps>
+ * [Key in keyof JSX.IntrinsicElements]?: ComponentType | keyof JSX.IntrinsicElements
* }} Components
* Map tag names to components.
*/
@@ -56,8 +56,6 @@
* cannot combine w/ `disallowedElements`.
* @property {string | null | undefined} [children]
* Markdown.
- * @property {string | null | undefined} [className]
- * Wrap in a `div` with this class name.
* @property {Components | null | undefined} [components]
* Map tag names to components.
* @property {ReadonlyArray | null | undefined} [disallowedElements]
@@ -79,6 +77,19 @@
* Change URLs (default: `defaultUrlTransform`)
*/
+/**
+ * @typedef HooksOptionsOnly
+ * Configuration specifically for {@linkcode MarkdownHooks}.
+ * @property {ReactNode | null | undefined} [fallback]
+ * Content to render while the processor processing the markdown (optional).
+ */
+
+/**
+ * @typedef {Options & HooksOptionsOnly} HooksOptions
+ * Configuration for {@linkcode MarkdownHooks};
+ * extends the regular {@linkcode Options} with a `fallback` prop.
+ */
+
/**
* @callback UrlTransform
* Transform all URLs.
@@ -96,7 +107,7 @@ import {unreachable} from 'devlop'
import {toJsxRuntime} from 'hast-util-to-jsx-runtime'
import {urlAttributes} from 'html-url-attributes'
import {Fragment, jsx, jsxs} from 'react/jsx-runtime'
-import {createElement, useEffect, useState} from 'react'
+import {useEffect, useState} from 'react'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import {unified} from 'unified'
@@ -127,6 +138,7 @@ const deprecations = [
id: 'replace-allownode-allowedtypes-and-disallowedtypes',
to: 'allowedElements'
},
+ {from: 'className', id: 'remove-classname'},
{
from: 'disallowedTypes',
id: 'replace-allownode-allowedtypes-and-disallowedtypes',
@@ -194,10 +206,10 @@ export async function MarkdownAsync(options) {
* For async support on the server,
* see {@linkcode MarkdownAsync}.
*
- * @param {Readonly} options
+ * @param {Readonly} options
* Props.
- * @returns {ReactElement}
- * React element.
+ * @returns {ReactNode}
+ * React node.
*/
export function MarkdownHooks(options) {
const processor = createProcessor(options)
@@ -207,13 +219,24 @@ export function MarkdownHooks(options) {
const [tree, setTree] = useState(/** @type {Root | undefined} */ (undefined))
useEffect(
- /* c8 ignore next 7 -- hooks are client-only. */
function () {
+ let cancelled = false
const file = createFile(options)
+
processor.run(processor.parse(file), file, function (error, tree) {
- setError(error)
- setTree(tree)
+ if (!cancelled) {
+ setError(error)
+ setTree(tree)
+ }
})
+
+ /**
+ * @returns {undefined}
+ * Nothing.
+ */
+ return function () {
+ cancelled = true
+ }
},
[
options.children,
@@ -223,11 +246,9 @@ export function MarkdownHooks(options) {
]
)
- /* c8 ignore next -- hooks are client-only. */
if (error) throw error
- /* c8 ignore next -- hooks are client-only. */
- return tree ? post(tree, options) : createElement(Fragment)
+ return tree ? post(tree, options) : options.fallback
}
/**
@@ -322,26 +343,10 @@ function post(tree, options) {
)
}
- // Wrap in `div` if there’s a class name.
- if (options.className) {
- tree = {
- type: 'element',
- tagName: 'div',
- properties: {className: options.className},
- // Assume no doctypes.
- children: /** @type {Array} */ (
- tree.type === 'root' ? tree.children : [tree]
- )
- }
- }
-
visit(tree, transform)
return toJsxRuntime(tree, {
Fragment,
- // @ts-expect-error
- // React components are allowed to return numbers,
- // but not according to the types in hast-util-to-jsx-runtime
components,
ignoreInvalidStyle: true,
jsx,
diff --git a/node_modules/react-markdown/package.json b/node_modules/react-markdown/package.json
index 8b5dce3..35fe1fa 100644
--- a/node_modules/react-markdown/package.json
+++ b/node_modules/react-markdown/package.json
@@ -62,6 +62,7 @@
},
"description": "React component to render markdown",
"devDependencies": {
+ "@testing-library/react": "^16.0.0",
"@types/node": "^22.0.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
@@ -69,6 +70,7 @@
"concat-stream": "^2.0.0",
"esbuild": "^0.25.0",
"eslint-plugin-react": "^7.0.0",
+ "global-jsdom": "^26.0.0",
"prettier": "^3.0.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
@@ -141,7 +143,7 @@
"strict": true
},
"type": "module",
- "version": "9.1.0",
+ "version": "10.1.0",
"xo": {
"envs": [
"shared-node-browser"
diff --git a/node_modules/react-markdown/readme.md b/node_modules/react-markdown/readme.md
index d1ff26c..ecdd661 100644
--- a/node_modules/react-markdown/readme.md
+++ b/node_modules/react-markdown/readme.md
@@ -38,6 +38,7 @@ React component to render markdown.
* [`AllowElement`](#allowelement)
* [`Components`](#components)
* [`ExtraProps`](#extraprops)
+ * [`HooksOptions`](#hooksoptions)
* [`Options`](#options)
* [`UrlTransform`](#urltransform)
* [Examples](#examples)
@@ -47,7 +48,6 @@ React component to render markdown.
* [Use remark and rehype plugins (math)](#use-remark-and-rehype-plugins-math)
* [Plugins](#plugins)
* [Syntax](#syntax)
-* [Types](#types)
* [Compatibility](#compatibility)
* [Architecture](#architecture)
* [Appendix A: HTML in markdown](#appendix-a-html-in-markdown)
@@ -101,14 +101,14 @@ npm install react-markdown
In Deno with [`esm.sh`][esmsh]:
```js
-import Markdown from 'https://esm.sh/react-markdown@9'
+import Markdown from 'https://esm.sh/react-markdown@10'
```
In browsers with [`esm.sh`][esmsh]:
```html
```
@@ -175,6 +175,15 @@ and
[`defaultUrlTransform`][api-default-url-transform].
The default export is [`Markdown`][api-markdown].
+It also exports the additional [TypeScript][] types
+[`AllowElement`][api-allow-element],
+[`Components`][api-components],
+[`ExtraProps`][api-extra-props],
+[`HooksOptions`][api-hooks-options],
+[`Options`][api-options],
+and
+[`UrlTransform`][api-url-transform].
+
### `Markdown`
Component to render markdown.
@@ -191,7 +200,7 @@ see [`MarkdownAsync`][api-markdown-async] or
###### Returns
-React element (`JSX.Element`).
+React element (`ReactElement`).
### `MarkdownAsync`
@@ -209,7 +218,7 @@ see [`MarkdownHooks`][api-markdown-hooks].
###### Returns
-Promise to a React element (`Promise`).
+Promise to a React element (`Promise`).
### `MarkdownHooks`
@@ -227,7 +236,7 @@ see [`MarkdownAsync`][api-markdown-async].
###### Returns
-React element (`JSX.Element`).
+React node (`ReactNode`).
### `defaultUrlTransform(url)`
@@ -266,17 +275,12 @@ Map tag names to components (TypeScript type).
###### Type
```ts
-import type {Element} from 'hast'
-
-type Components = Partial<{
- [TagName in keyof JSX.IntrinsicElements]:
- // Class component:
- | (new (props: JSX.IntrinsicElements[TagName] & ExtraProps) => JSX.ElementClass)
- // Function component:
- | ((props: JSX.IntrinsicElements[TagName] & ExtraProps) => JSX.Element | string | null | undefined)
- // Tag name:
- | keyof JSX.IntrinsicElements
-}>
+import type {ExtraProps} from 'react-markdown'
+import type {ComponentProps, ElementType} from 'react'
+
+type Components = {
+ [Key in Extract]?: ElementType & ExtraProps>
+}
```
### `ExtraProps`
@@ -288,6 +292,20 @@ Extra fields we pass to components (TypeScript type).
* `node` ([`Element` from `hast`][github-hast-element], optional)
— original node
+### `HooksOptions`
+
+Configuration for [`MarkdownHooks`][api-markdown-hooks] (TypeScript type);
+extends the regular [`Options`][api-options] with a `fallback` prop.
+
+###### Extends
+
+[`Options`][api-options].
+
+###### Fields
+
+* `fallback` (`ReactNode`, optional)
+ — content to render while the processor processing the markdown
+
### `Options`
Configuration (TypeScript type).
@@ -302,8 +320,6 @@ Configuration (TypeScript type).
cannot combine w/ `disallowedElements`
* `children` (`string`, optional)
— markdown
-* `className` (`string`, optional)
- — wrap in a `div` with this class name
* `components` ([`Components`][api-components], optional)
— map tag names to components
* `disallowedElements` (`Array`, default: `[]`)
@@ -585,16 +601,6 @@ We use [`micromark`][github-micromark] under the hood for our parsing.
See its documentation for more information on markdown, CommonMark, and
extensions.
-## Types
-
-This package is fully typed with [TypeScript][].
-It exports the additional types
-[`AllowElement`][api-allow-element],
-[`ExtraProps`][api-extra-props],
-[`Components`][api-components],
-[`Options`][api-options], and
-[`UrlTransform`][api-url-transform].
-
## Compatibility
Projects maintained by the unified collective are compatible with maintained
@@ -602,7 +608,7 @@ versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
-This means we try to keep the current release line, `react-markdown@^9`,
+This means we try to keep the current release line, `react-markdown@10`,
compatible with Node.js 16.
They work in all modern browsers (essentially: everything not IE 11).
@@ -823,6 +829,8 @@ abide by its terms.
[api-extra-props]: #extraprops
+[api-hooks-options]: #hooksoptions
+
[api-markdown]: #markdown
[api-markdown-async]: #markdownasync