diff --git a/.gitignore b/.gitignore
index f19ff24..ce84e07 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ node_modules/
.DS_Store
react-markdown.min.js
yarn.lock
+!/test-types.d.ts
diff --git a/lib/index.js b/lib/index.js
index d3d201f..529639c 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -318,11 +318,11 @@ export function defaultUrlTransform(value) {
if (
// If there is no protocol, it’s relative.
- colon < 0 ||
+ colon === -1 ||
// If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
- (slash > -1 && colon > slash) ||
- (questionMark > -1 && colon > questionMark) ||
- (numberSign > -1 && colon > numberSign) ||
+ (slash !== -1 && colon > slash) ||
+ (questionMark !== -1 && colon > questionMark) ||
+ (numberSign !== -1 && colon > numberSign) ||
// It is a protocol, it should be allowed.
safeProtocol.test(value.slice(0, colon))
) {
diff --git a/package.json b/package.json
index c051f5e..b107383 100644
--- a/package.json
+++ b/package.json
@@ -94,14 +94,14 @@
},
"devDependencies": {
"@types/node": "^22.0.0",
- "@types/react": "^18.0.0",
- "@types/react-dom": "^18.0.0",
+ "@types/react": "^19.0.0",
+ "@types/react-dom": "^19.0.0",
"c8": "^10.0.0",
"esbuild": "^0.24.0",
"eslint-plugin-react": "^7.0.0",
"prettier": "^3.0.0",
- "react": "^18.0.0",
- "react-dom": "^18.0.0",
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0",
"rehype-raw": "^7.0.0",
"remark-cli": "^12.0.0",
"remark-gfm": "^4.0.0",
@@ -109,7 +109,7 @@
"remark-toc": "^9.0.0",
"type-coverage": "^2.0.0",
"typescript": "^5.0.0",
- "xo": "^0.59.0"
+ "xo": "^0.60.0"
},
"scripts": {
"build": "tsc --build --clean && tsc --build && type-coverage",
diff --git a/test-types.d.ts b/test-types.d.ts
new file mode 100644
index 0000000..4dd67e3
--- /dev/null
+++ b/test-types.d.ts
@@ -0,0 +1,9 @@
+import type {JSX as Jsx} from 'react/jsx-runtime'
+
+declare global {
+ namespace JSX {
+ type ElementClass = Jsx.ElementClass
+ type Element = Jsx.Element
+ type IntrinsicElements = Jsx.IntrinsicElements
+ }
+}
diff --git a/test-types.js b/test-types.js
new file mode 100644
index 0000000..f3ea4d4
--- /dev/null
+++ b/test-types.js
@@ -0,0 +1,2 @@
+// See `test-types.d.ts`.
+export {}
diff --git a/test.jsx b/test.jsx
index 8223918..f127de1 100644
--- a/test.jsx
+++ b/test.jsx
@@ -167,21 +167,24 @@ test('react-markdown', async function (t) {
await t.test('should support an image', function () {
assert.equal(
renderToStaticMarkup(