Skip to content

Commit 5b2c3d4

Browse files
committed
docs: update and add customization sections
1 parent 14b9995 commit 5b2c3d4

File tree

1 file changed

+80
-10
lines changed

1 file changed

+80
-10
lines changed

docs/content/2.guide/1.features.md

Lines changed: 80 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,89 @@ Quick access to online development environments detected from package READMEs:
9292

9393
### Custom badges
9494

95-
You can add custom npmx badges to your markdown files using the following syntax: `[![Open on npmx.dev](https://npmx.dev/api/registry/badge/YOUR_PACKAGE)](https://npmx.dev/YOUR_PACKAGE)`
95+
You can add custom npmx badges to your markdown files using the following syntax:
96+
`[![Open on npmx.dev](https://npmx.dev/api/registry/badge/TYPE/YOUR_PACKAGE)](https://npmx.dev/package/YOUR_PACKAGE)`
9697

97-
Do not forget to replace `YOUR_PACKAGE` with the actual package name.
98+
> [!IMPORTANT]
99+
> Make sure to replace `TYPE` with one of the options listed below and `YOUR_PACKAGE` with the actual package name (e.g., `vue`, `lodash`, or `@nuxt/kit`).
98100
99-
Here are some examples:
101+
#### Available Badge Types
100102

101-
```
102-
# Default
103-
[![Open on npmx.dev](https://npmx.dev/api/registry/badge/nuxt)](https://npmx.dev/nuxt)
103+
- **version**: Shows the latest or specific version of the package. ![](https://img.shields.io/badge/%233b82f6-3b82f6)
104+
- **license**: Displays the package license (e.g., MIT, Apache-2.0). ![](https://img.shields.io/badge/%2322c55e-22c55e)
105+
- **size**: Shows the install size (via Bundlephobia) or unpacked size. ![](https://img.shields.io/badge/%23a855f7-a855f7)
106+
- **downloads**: Displays monthly download statistics. ![](https://img.shields.io/badge/%23f97316-f97316)
107+
- **downloads-day**: Displays daily download statistics. ![](https://img.shields.io/badge/%23f97316-f97316)
108+
- **downloads-week**: Displays weekly download statistics. ![](https://img.shields.io/badge/%23f97316-f97316)
109+
- **downloads-month**: Alias for monthly download statistics. ![](https://img.shields.io/badge/%23f97316-f97316)
110+
- **downloads-year**: Displays yearly download statistics. ![](https://img.shields.io/badge/%23f97316-f97316)
111+
- **vulnerabilities**: Shows the number of vulnerabilities found via OSV. ![](https://img.shields.io/badge/%2322c55e-22c55e) / ![](https://img.shields.io/badge/%23ef4444-ef4444)
112+
- **dependencies**: Lists the total count of package dependencies. ![](https://img.shields.io/badge/%2306b6d4-06b6d4)
113+
- **created**: Displays the date the package was first published. ![](https://img.shields.io/badge/%2364748b-64748b)
114+
- **updated**: Displays the date of the most recent modification. ![](https://img.shields.io/badge/%2364748b-64748b)
115+
- **engines**: Shows the supported Node.js version range. ![](https://img.shields.io/badge/%23eab308-eab308)
116+
- **types**: Indicates if TypeScript types are included. ![](https://img.shields.io/badge/%233b82f6-3b82f6) / ![](https://img.shields.io/badge/%2364748b-64748b)
117+
- **maintainers**: Displays the total count of package maintainers. ![](https://img.shields.io/badge/%2306b6d4-06b6d4)
118+
- **deprecated**: Shows if the package is active or deprecated. ![](https://img.shields.io/badge/%2322c55e-22c55e) / ![](https://img.shields.io/badge/%23ef4444-ef4444)
119+
- **quality**: NPMS.io quality score based on linting and tests. ![](https://img.shields.io/badge/%23a855f7-a855f7)
120+
- **popularity**: NPMS.io popularity score based on downloads and stars. ![](https://img.shields.io/badge/%2306b6d4-06b6d4)
121+
- **maintenance**: NPMS.io maintenance score based on activity. ![](https://img.shields.io/badge/%23eab308-eab308)
122+
- **score**: The overall NPMS.io combined score. ![](https://img.shields.io/badge/%233b82f6-3b82f6)
123+
- **name**: Simple badge displaying the package name. ![](https://img.shields.io/badge/%2364748b-64748b)
124+
125+
#### Examples
126+
127+
```markdown
128+
# Version Badge
129+
130+
[![Open on npmx.dev](https://npmx.dev/api/registry/badge/version/nuxt)](https://npmx.dev/package/nuxt)
131+
132+
# License Badge
133+
134+
[![Open on npmx.dev](https://npmx.dev/api/registry/badge/license/vue)](https://npmx.dev/package/vue)
135+
136+
# Monthly Downloads
137+
138+
[![Open on npmx.dev](https://npmx.dev/api/registry/badge/downloads/lodash)](https://npmx.dev/package/lodash)
139+
140+
# Scoped Package (Install Size)
141+
142+
[![Open on npmx.dev](https://npmx.dev/api/registry/badge/size/@nuxt/kit)](https://npmx.dev/package/@nuxt/kit)
143+
144+
# Specific Version
104145

105-
# Organization packages
106-
[![Open on npmx.dev](https://npmx.dev/api/registry/badge/@nuxt/kit)](https://npmx.dev/@nuxt/kit)
146+
[![Open on npmx.dev](https://npmx.dev/api/registry/badge/version/react/v/18.0.0)](https://npmx.dev/package/react)
107147

108-
# Version-specific badges
109-
[![Open on npmx.dev](https://npmx.dev/api/registry/badge/nuxt/v/3.12.0)](https://npmx.dev/nuxt/v/3.12.0)
148+
# Quality Score
149+
150+
[![Open on npmx.dev](https://npmx.dev/api/registry/badge/quality/pinia)](https://npmx.dev/package/pinia)
110151
```
152+
153+
#### Customization Parameters
154+
155+
You can further customize your badges by appending query parameters to the badge URL.
156+
157+
##### `color`
158+
159+
Overrides the default strategy color. You can pass a standard hex code (with or without the `#` prefix).
160+
161+
- **Default**: Depends on the badge type (e.g., version is blue, downloads are orange).
162+
- **Usage**: `?color=HEX_CODE`
163+
164+
| Example | URL |
165+
| :------------- | :------------------------------------ |
166+
| **Hot Pink** | `.../badge/version/nuxt?color=ff69b4` |
167+
| **Pure Black** | `.../badge/version/nuxt?color=000000` |
168+
| **Brand Blue** | `.../badge/version/nuxt?color=3b82f6` |
169+
170+
##### `name`
171+
172+
When set to `true`, this parameter replaces the static category label (like "version" or "downloads/mo") with the actual name of the package. This is useful for brand-focused READMEs.
173+
174+
- **Default**: `false`
175+
- **Usage**: `?name=true`
176+
177+
| Type | Default Label | With `name=true` |
178+
| :------------ | :------------ | :--------------- | ------- | ------- |
179+
| **Version** | `version | 3.12.0` | `nuxt | 3.12.0` |
180+
| **Downloads** | `downloads/mo | 2M` | `lodash | 2M` |

0 commit comments

Comments
 (0)