Gathering detailed insights and metrics for @dword-design/rehype-urls
Gathering detailed insights and metrics for @dword-design/rehype-urls
Gathering detailed insights and metrics for @dword-design/rehype-urls
Gathering detailed insights and metrics for @dword-design/rehype-urls
npm install @dword-design/rehype-urls
Typescript
Module System
Node Version
NPM Version
66.3
Supply Chain
89.8
Quality
74.8
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
14 Stars
9 Commits
3 Forks
2 Watchers
1 Branches
3 Contributors
Updated on Jul 08, 2024
Latest Version
0.0.1
Package Id
@dword-design/rehype-urls@0.0.1
Unpacked Size
15.81 kB
Size
5.75 kB
File Count
7
NPM Version
9.5.1
Node Version
18.16.0
Published on
Jun 09, 2023
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
3
Rehype plugin to rewrite URLs of href
and src
attributes.
1npm install rehype-urls
Given this markup:
1<article> 2 <img src="http://internal.site/image.jpg"> 3 <a href="http://internal.site/page.html">page</a> 4 <a href="http://example.com">link</a> 5</article>
You can use the following script:
1var rehype = require('rehype') 2var urls = require('rehype-urls') 3 4rehype() 5 .use(urls, removeBaseUrl) 6 .process(input, handleOutput) 7 8function removeBaseUrl (url) { 9 if (url.host === 'internal.site') { 10 return url.path 11 } 12}
Which will transform it into:
1<article> 2 <img src="/image.jpg"> 3 <a href="/page.html">page</a> 4 <a href="http://example.com">link</a> 5</article>
You can also pass in an object:
1rehype() 2 .use(urls, { transform: removeBaseUrl }) 3 .process(input, handleOutput)
It's also possible to mutate the URL nodes directly. This example will add target="_blank"
to any external links:
1var rehype = require('rehype') 2var urls = require('rehype-urls') 3 4rehype() 5 .use(urls, blankExternal) 6 .process(input, handleOutput) 7 8function blankExternal (url, node) { 9 if (url.host !== 'internal.site') { 10 node.properties.target = '_blank' 11 } 12}
Apache-2.0
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/7 approved changesets -- score normalized to 2
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
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
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