Skip to main content
Glama

EverArt Forge MCP Server

removeDimensions.js1.26 kB
'use strict'; exports.name = 'removeDimensions'; exports.description = 'removes width and height in presence of viewBox (opposite to removeViewBox, disable it first)'; /** * Remove width/height attributes and add the viewBox attribute if it's missing * * @example * <svg width="100" height="50" /> * ↓ * <svg viewBox="0 0 100 50" /> * * @author Benny Schudel * * @type {import('./plugins-types').Plugin<'removeDimensions'>} */ exports.fn = () => { return { element: { enter: (node) => { if (node.name === 'svg') { if (node.attributes.viewBox != null) { delete node.attributes.width; delete node.attributes.height; } else if ( node.attributes.width != null && node.attributes.height != null && Number.isNaN(Number(node.attributes.width)) === false && Number.isNaN(Number(node.attributes.height)) === false ) { const width = Number(node.attributes.width); const height = Number(node.attributes.height); node.attributes.viewBox = `0 0 ${width} ${height}`; delete node.attributes.width; delete node.attributes.height; } } }, }, }; };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nickbaumann98/everart-forge-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server