Home / Function/ plugin() — astro Function Reference

plugin() — astro Function Reference

Architecture documentation for the plugin() function in remarkPlugin.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  25efbcb9_204e_a3ce_cd86_ee2167ec4033["plugin()"]
  37feb0da_5287_6603_c411_6cbdb0625dad["remarkPlugin.js"]
  25efbcb9_204e_a3ce_cd86_ee2167ec4033 -->|defined in| 37feb0da_5287_6603_c411_6cbdb0625dad
  style 25efbcb9_204e_a3ce_cd86_ee2167ec4033 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/core-image-remark-imgattr/remarkPlugin.js lines 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);
	}
}

Subdomains

Frequently Asked Questions

What does plugin() do?
plugin() is a function in the astro codebase, defined in packages/astro/test/fixtures/core-image-remark-imgattr/remarkPlugin.js.
Where is plugin() defined?
plugin() is defined in packages/astro/test/fixtures/core-image-remark-imgattr/remarkPlugin.js at line 1.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free