rehype-image-caption 2.0.7 → 2.0.9

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -1
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -7,7 +7,17 @@ import { visit } from "unist-util-visit";
7
7
  * @param node Node to check
8
8
  * @returns `true` if the node is an image, `false` otherwise
9
9
  */
10
- const isImage = (node) => isElement(node, "img") || (node.type === "mdxJsxFlowElement" && ["astro-image", "img"].includes(node.name ?? ""));
10
+ const isImage = (node) => {
11
+ try {
12
+ if (node.type === "mdxJsxFlowElement" && ["astro-image", "img"].includes(node.name ?? "")) {
13
+ return true;
14
+ }
15
+ return isElement(node, "img");
16
+ }
17
+ catch {
18
+ return false;
19
+ }
20
+ };
11
21
  /**
12
22
  * `rehype` plugin to set captions for images in addition to alt text.
13
23
  * @returns Transformer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rehype-image-caption",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "rehype plugin to set captions for images in addition to alt text.",
5
5
  "publishConfig": {
6
6
  "provenance": true
@@ -38,7 +38,7 @@
38
38
  "devDependencies": {
39
39
  "@changesets/changelog-github": "^0.5.0",
40
40
  "@changesets/cli": "^2.27.1",
41
- "@robot-inventor/eslint-config": "^5.0.0",
41
+ "@robot-inventor/eslint-config": "^6.0.0",
42
42
  "@robot-inventor/tsconfig-base": "^1.1.0",
43
43
  "eslint": "^9.0.0",
44
44
  "prettier": "^3.2.5",