aboutsummaryrefslogtreecommitdiff
path: root/packages/astro/test/fixtures/core-image-remark-imgattr/remarkPlugin.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro/test/fixtures/core-image-remark-imgattr/remarkPlugin.js')
-rw-r--r--packages/astro/test/fixtures/core-image-remark-imgattr/remarkPlugin.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/astro/test/fixtures/core-image-remark-imgattr/remarkPlugin.js b/packages/astro/test/fixtures/core-image-remark-imgattr/remarkPlugin.js
new file mode 100644
index 000000000..4bad8fb77
--- /dev/null
+++ b/packages/astro/test/fixtures/core-image-remark-imgattr/remarkPlugin.js
@@ -0,0 +1,20 @@
+export default function plugin() {
+ return transformer;
+
+ function transformer(tree) {
+ function traverse(node) {
+ if (node.type === "image") {
+ node.data = node.data || {};
+ node.data.hProperties = node.data.hProperties || {};
+ node.data.hProperties.loading = "eager";
+ node.data.hProperties.width = "50";
+ }
+
+ if (node.children) {
+ node.children.forEach(traverse);
+ }
+ }
+
+ traverse(tree);
+ }
+}