
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@thinkeloquent/xast-append-ids
Advanced tools
An xast plugin to append deterministic IDs to XML elements with proper namespace support.
npm install @thinkeloquent/xast-append-ids
import { unified } from 'unified';
import { fromXml } from 'xast-util-from-xml';
import { toXml } from 'xast-util-to-xml';
import xastAppendIds from '@thinkeloquent/xast-append-ids';
const processor = unified()
.use(xastFromXml)
.use(xastAppendIds, {
selector: '*:not([xml:id])',
attr: 'xml:id',
strategy: 'hash',
prefix: 'xml-',
overwrite: false
})
.use(xastToXml);
const xml = '<root><element>Content</element></root>';
const result = processor.processSync(xml).toString();
// <root><element xml:id="xml-a1b2c3d4">Content</element></root>
selector (string, default: '*:not([id])') - CSS selector for targeting elementsattr (string, default: 'data-ast-id') - Attribute name for the ID (supports namespaces like 'xml:id')strategy (string, default: 'hash') - ID generation strategy: 'hash', 'slug', or 'path'prefix (string, default: 'el-') - Prefix for generated IDsoverwrite (boolean, default: false) - Whether to overwrite existing IDsnamespace (string, optional) - XML namespace prefix for the ID attributeThis plugin correctly handles XML namespaces. You can use namespaced attributes like xml:id:
{
attr: 'xml:id', // Namespaced attribute
namespace: 'custom' // Custom namespace prefix
}
Generates a deterministic hash from the element's path and content.
Creates IDs from the element's text content.
Generates IDs based on the element's position in the tree.
This package uses ES Modules (ESM) with .mjs file extension. Make sure your project supports ESM or configure your build tools accordingly.
This package depends on:
@thinkeloquent/id-generator - Core ID generation utilitiesxast-util-select - CSS selector support for XASTunist-util-visit - Tree traversal utilitiesMIT
FAQs
XAST plugin to append deterministic IDs to XML elements
We found that @thinkeloquent/xast-append-ids demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.