rehype-remove-empty-attribute
Advanced tools
Comparing version 4.0.0 to 4.0.1
export { default } from "./lib/index.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -8,2 +8,3 @@ /** | ||
export default function rehypeRemoveEmptyAttribute(): (tree: Root) => undefined; | ||
export type Root = import('hast').Root; | ||
import type { Root } from 'hast'; | ||
//# sourceMappingURL=index.d.ts.map |
/** | ||
* @typedef {import('hast').Root} Root | ||
* @import {Root} from 'hast' | ||
*/ | ||
@@ -26,14 +26,15 @@ | ||
/** @type {string} */ | ||
let prop | ||
let property | ||
for (prop in node.properties) { | ||
if (Object.hasOwn(node.properties, prop)) { | ||
const value = node.properties[prop] | ||
for (property in node.properties) { | ||
if (Object.hasOwn(node.properties, property)) { | ||
const value = node.properties[property] | ||
if ( | ||
(value === '' || (Array.isArray(value) && value.length === 0)) && | ||
(isEventHandler(prop) || | ||
(Object.hasOwn(schema, prop) && isElement(node, schema[prop]))) | ||
(isEventHandler(property) || | ||
(Object.hasOwn(schema, property) && | ||
isElement(node, schema[property]))) | ||
) { | ||
node.properties[prop] = undefined | ||
node.properties[property] = undefined | ||
} | ||
@@ -40,0 +41,0 @@ } |
/** @type {Record<string, Array<string> | string | null>} */ | ||
export const schema: Record<string, Array<string> | string | null>; | ||
//# sourceMappingURL=schema.d.ts.map |
{ | ||
"name": "rehype-remove-empty-attribute", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "rehype plugin to remove empty attributes", | ||
@@ -32,2 +32,3 @@ "license": "MIT", | ||
"index.d.ts", | ||
"index.d.ts.map", | ||
"index.js", | ||
@@ -49,3 +50,8 @@ "lib/" | ||
}, | ||
"xo": false | ||
"xo": { | ||
"prettier": true, | ||
"rules": { | ||
"capitalized-comments": "off" | ||
} | ||
} | ||
} |
@@ -17,16 +17,16 @@ <!--This file is generated--> | ||
* [What is this?](#what-is-this) | ||
* [When should I use this?](#when-should-i-use-this) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [API](#api) | ||
* [`unified().use(rehypeRemoveEmptyAttribute)`](#unifieduserehyperemoveemptyattribute) | ||
* [Example](#example) | ||
* [Syntax](#syntax) | ||
* [Syntax tree](#syntax-tree) | ||
* [Types](#types) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
* [What is this?](#what-is-this) | ||
* [When should I use this?](#when-should-i-use-this) | ||
* [Install](#install) | ||
* [Use](#use) | ||
* [API](#api) | ||
* [`unified().use(rehypeRemoveEmptyAttribute)`](#unifieduserehyperemoveemptyattribute) | ||
* [Example](#example) | ||
* [Syntax](#syntax) | ||
* [Syntax tree](#syntax-tree) | ||
* [Types](#types) | ||
* [Compatibility](#compatibility) | ||
* [Security](#security) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
@@ -33,0 +33,0 @@ ## What is this? |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12143
12
179
0