plugin() — astro Function Reference
Architecture documentation for the plugin() function in remarkPlugin.js from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 5cd4c703_c639_a3f9_69b0_788af79a6478["plugin()"] 9853324b_d3c8_642d_8be9_d67aa6b454e0["remarkPlugin.js"] 5cd4c703_c639_a3f9_69b0_788af79a6478 -->|defined in| 9853324b_d3c8_642d_8be9_d67aa6b454e0 style 5cd4c703_c639_a3f9_69b0_788af79a6478 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/integrations/mdx/test/fixtures/image-remark-imgattr/remarkPlugin.js lines 1–22
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.id = "test";
node.data.hProperties.width = "300";
node.data.hProperties.widths = [300,600];
node.data.hProperties.sizes = "(min-width: 600px) 600w, 300w";
}
if (node.children) {
node.children.forEach(traverse);
}
}
traverse(tree);
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does plugin() do?
plugin() is a function in the astro codebase, defined in packages/integrations/mdx/test/fixtures/image-remark-imgattr/remarkPlugin.js.
Where is plugin() defined?
plugin() is defined in packages/integrations/mdx/test/fixtures/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