Gathering detailed insights and metrics for posthtml-rename-id
Gathering detailed insights and metrics for posthtml-rename-id
Gathering detailed insights and metrics for posthtml-rename-id
Gathering detailed insights and metrics for posthtml-rename-id
Node.js toolset for generating & transforming SVG images and sprites in modern way
npm install posthtml-rename-id
Typescript
Module System
Node Version
NPM Version
JavaScript (97.31%)
CSS (1.44%)
HTML (0.98%)
EJS (0.27%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
175 Stars
656 Commits
42 Forks
9 Watchers
50 Branches
63 Contributors
Updated on Apr 08, 2025
Latest Version
1.0.12
Package Id
posthtml-rename-id@1.0.12
Unpacked Size
8.88 kB
Size
3.16 kB
File Count
5
NPM Version
lerna/3.20.2/node@v10.19.0+x64 (darwin)
Node Version
10.19.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
PostHTML plugin to rename id attributes and it's references. Inspired by grunt-svgstore.
Handle following cases:
href="#id"
and xlink:href="#id"
style
attribute values like style="fill: url(#id)"
<style>
tag values like .selector {fill: url(#id)"}
attr="url(#id)"
Input
1<style> 2.selector {fill: url(#qwe)} 3</style> 4 5<div id="qwe"></div> 6<a href="#qwe"></a>
Output
1<style> 2.selector {fill: url(#prefix_qwe)} 3</style> 4 5<div id="prefix_qwe"></div> 6<a href="#prefix_qwe"></a>
1npm install posthtml-rename-id
1const posthtml = require('posthtml'); 2const rename = require('posthtml-rename-id'); 3 4posthtml() 5 .use(rename('prefix_[id]')) 6 .process('<div id="qwe"></div> <a href="#qwe"></a>') 7 .then(({ html }) => { 8 console.log(html); // <div id="prefix_qwe"></div> <a href="#prefix_qwe"></a> 9 });
pattern
Type:
string | function
Default:'[id]'
Renaming pattern. [id]
placeholder can be used as current id of an element.
If pattern
provided as a function it will be called with current id as first argument.
Function should return the new id as string ([id]
can be used as well).
Uppercase all ids:
1posthtml([ 2 renameId(id => id.toUpperCase()) 3]);
Rename all ids to elem_{counter}
:
1let c = 0; 2posthtml([ 3 renameId((id) => { c++; return 'elem_' + c; }) 4]);
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
117 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More