@nerox_dev/remark-entity-chips 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -0
- package/dist/data/entities.d.ts +4 -0
- package/dist/data/entities.d.ts.map +1 -0
- package/dist/data/entities.js +1740 -0
- package/dist/data/entities.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/index.d.ts +6 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +102 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/parser.d.ts +11 -0
- package/dist/plugin/parser.d.ts.map +1 -0
- package/dist/plugin/parser.js +21 -0
- package/dist/plugin/parser.js.map +1 -0
- package/dist/plugin/renderer.d.ts +7 -0
- package/dist/plugin/renderer.d.ts.map +1 -0
- package/dist/plugin/renderer.js +133 -0
- package/dist/plugin/renderer.js.map +1 -0
- package/dist/plugin/url-detector.d.ts +9 -0
- package/dist/plugin/url-detector.d.ts.map +1 -0
- package/dist/plugin/url-detector.js +28 -0
- package/dist/plugin/url-detector.js.map +1 -0
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/entity-lookup.d.ts +5 -0
- package/dist/utils/entity-lookup.d.ts.map +1 -0
- package/dist/utils/entity-lookup.js +11 -0
- package/dist/utils/entity-lookup.js.map +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# @nerox_dev/remark-entity-chips
|
|
2
|
+
|
|
3
|
+
Transform entity mentions into rich, visual chips in Markdown. Works with Astro, Next.js, Docusaurus, and any remark-based pipeline.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Examples
|
|
8
|
+
|
|
9
|
+
### Entity Mentions (`@[entity]`)
|
|
10
|
+
|
|
11
|
+
Entities in the built-in database are automatically resolved with their name, favicon, and URL.
|
|
12
|
+
|
|
13
|
+
<table>
|
|
14
|
+
<tr><th>Markdown</th><th>Result</th></tr>
|
|
15
|
+
<tr>
|
|
16
|
+
<td><code>@[stripe]</code></td>
|
|
17
|
+
<td><a href="https://stripe.com"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&size=48&url=http://stripe.com" alt="Stripe" width="16" height="16" /> Stripe</a></td>
|
|
18
|
+
</tr>
|
|
19
|
+
<tr>
|
|
20
|
+
<td><code>@[github]</code></td>
|
|
21
|
+
<td><a href="https://github.com"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://github.com&size=48" alt="GitHub" width="16" height="16" /> GitHub</a></td>
|
|
22
|
+
</tr>
|
|
23
|
+
<tr>
|
|
24
|
+
<td><code>@[openai]</code></td>
|
|
25
|
+
<td><a href="https://openai.com"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://openai.com&size=48" alt="OpenAI" width="16" height="16" /> OpenAI</a></td>
|
|
26
|
+
</tr>
|
|
27
|
+
<tr>
|
|
28
|
+
<td><code>@[react]</code></td>
|
|
29
|
+
<td><a href="https://react.dev"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://react.dev&size=48" alt="React" width="16" height="16" /> React</a></td>
|
|
30
|
+
</tr>
|
|
31
|
+
<tr>
|
|
32
|
+
<td><code>@[tailwindcss]</code></td>
|
|
33
|
+
<td><a href="https://tailwindcss.com"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://tailwindcss.com&size=48" alt="Tailwind CSS" width="16" height="16" /> Tailwind CSS</a></td>
|
|
34
|
+
</tr>
|
|
35
|
+
</table>
|
|
36
|
+
|
|
37
|
+
### Entity Mentions with Custom URL (`@[entity](url)`)
|
|
38
|
+
|
|
39
|
+
Use the entity's favicon and display name but link to a custom URL.
|
|
40
|
+
|
|
41
|
+
<table>
|
|
42
|
+
<tr><th>Markdown</th><th>Result</th></tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td><code>@[stripe](https://stripe.com/pricing)</code></td>
|
|
45
|
+
<td><a href="https://stripe.com/pricing"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&size=48&url=http://stripe.com" alt="Stripe" width="16" height="16" /> Stripe</a></td>
|
|
46
|
+
</tr>
|
|
47
|
+
</table>
|
|
48
|
+
|
|
49
|
+
### Custom Chips with Domain Favicon (`@[text](url)`)
|
|
50
|
+
|
|
51
|
+
If the text doesn't match an entity but the URL domain is in the database, the domain's favicon is used.
|
|
52
|
+
|
|
53
|
+
<table>
|
|
54
|
+
<tr><th>Markdown</th><th>Result</th></tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<td><code>@[Nerox_dev](https://x.com/nerox_dev)</code></td>
|
|
57
|
+
<td><a href="https://x.com/nerox_dev"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://x.com&size=48" alt="X" width="16" height="16" /> Nerox_dev</a></td>
|
|
58
|
+
</tr>
|
|
59
|
+
<tr>
|
|
60
|
+
<td><code>@[John Doe](https://linkedin.com/in/johndoe)</code></td>
|
|
61
|
+
<td><a href="https://linkedin.com/in/johndoe"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://linkedin.com&size=48" alt="LinkedIn" width="16" height="16" /> John Doe</a></td>
|
|
62
|
+
</tr>
|
|
63
|
+
<tr>
|
|
64
|
+
<td><code>@[My Portfolio](https://example.com)</code></td>
|
|
65
|
+
<td><a href="https://example.com">My Portfolio</a></td>
|
|
66
|
+
</tr>
|
|
67
|
+
</table>
|
|
68
|
+
|
|
69
|
+
### Auto-Detected Bare URLs (enabled by default)
|
|
70
|
+
|
|
71
|
+
Bare platform URLs in text are automatically transformed into chips.
|
|
72
|
+
|
|
73
|
+
<table>
|
|
74
|
+
<tr><th>Markdown</th><th>Result</th></tr>
|
|
75
|
+
<tr>
|
|
76
|
+
<td><code>https://youtube.com/watch?v=dQw4w9WgXcQ</code></td>
|
|
77
|
+
<td><a href="https://youtube.com/watch?v=dQw4w9WgXcQ"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://youtube.com&size=48" alt="YouTube" width="16" height="16" /> youtube.com/watch?v=dQw4w9WgXcQ</a></td>
|
|
78
|
+
</tr>
|
|
79
|
+
<tr>
|
|
80
|
+
<td><code>https://github.com/facebook/react</code></td>
|
|
81
|
+
<td><a href="https://github.com/facebook/react"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://github.com&size=48" alt="GitHub" width="16" height="16" /> github.com/facebook/react</a></td>
|
|
82
|
+
</tr>
|
|
83
|
+
<tr>
|
|
84
|
+
<td><code>https://x.com/nerox_dev</code></td>
|
|
85
|
+
<td><a href="https://x.com/nerox_dev"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://x.com&size=48" alt="X" width="16" height="16" /> x.com/nerox_dev</a></td>
|
|
86
|
+
</tr>
|
|
87
|
+
</table>
|
|
88
|
+
|
|
89
|
+
### Markdown Links (opt-in)
|
|
90
|
+
|
|
91
|
+
Standard markdown links `[text](url)` can optionally be transformed into chips. **Disabled by default** to avoid breaking existing content.
|
|
92
|
+
|
|
93
|
+
<table>
|
|
94
|
+
<tr><th>Markdown</th><th>Result (when enabled)</th></tr>
|
|
95
|
+
<tr>
|
|
96
|
+
<td><code>[React docs](https://react.dev)</code></td>
|
|
97
|
+
<td><a href="https://react.dev"><img src="https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://react.dev&size=48" alt="React" width="16" height="16" /> React docs</a></td>
|
|
98
|
+
</tr>
|
|
99
|
+
<tr>
|
|
100
|
+
<td><code>[My site](https://example.com)</code></td>
|
|
101
|
+
<td><a href="https://example.com">My site</a></td>
|
|
102
|
+
</tr>
|
|
103
|
+
</table>
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Installation
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npm install @nerox_dev/remark-entity-chips
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Quick Start
|
|
114
|
+
|
|
115
|
+
### Astro
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
// astro.config.mjs
|
|
119
|
+
import { defineConfig } from "astro/config";
|
|
120
|
+
import entityChips from "@nerox_dev/remark-entity-chips";
|
|
121
|
+
|
|
122
|
+
export default defineConfig({
|
|
123
|
+
markdown: {
|
|
124
|
+
remarkPlugins: [entityChips],
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Next.js
|
|
130
|
+
|
|
131
|
+
```js
|
|
132
|
+
// next.config.mjs
|
|
133
|
+
import createMDX from "@next/mdx";
|
|
134
|
+
import entityChips from "@nerox_dev/remark-entity-chips";
|
|
135
|
+
|
|
136
|
+
const withMDX = createMDX({
|
|
137
|
+
options: {
|
|
138
|
+
remarkPlugins: [entityChips],
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
export default withMDX({});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Docusaurus
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
// docusaurus.config.js
|
|
149
|
+
const entityChips = require("@nerox_dev/remark-entity-chips").default;
|
|
150
|
+
|
|
151
|
+
module.exports = {
|
|
152
|
+
presets: [
|
|
153
|
+
[
|
|
154
|
+
"classic",
|
|
155
|
+
{
|
|
156
|
+
docs: { remarkPlugins: [entityChips] },
|
|
157
|
+
blog: { remarkPlugins: [entityChips] },
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
],
|
|
161
|
+
};
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Configuration
|
|
165
|
+
|
|
166
|
+
```js
|
|
167
|
+
import entityChips from "@nerox_dev/remark-entity-chips";
|
|
168
|
+
|
|
169
|
+
[
|
|
170
|
+
entityChips,
|
|
171
|
+
{
|
|
172
|
+
// Transform bare URLs into chips (default: true)
|
|
173
|
+
autoDetectUrls: true,
|
|
174
|
+
|
|
175
|
+
// Transform markdown links [text](url) into chips (default: false)
|
|
176
|
+
transformMarkdownLinks: false,
|
|
177
|
+
|
|
178
|
+
// Custom CSS class names
|
|
179
|
+
classNames: {
|
|
180
|
+
chip: "entity-chip", // default
|
|
181
|
+
favicon: "entity-favicon", // default
|
|
182
|
+
name: "entity-name", // default
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
];
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
| Option | Type | Default | Description |
|
|
189
|
+
| ------------------------ | --------- | ------------------ | ---------------------------------------- |
|
|
190
|
+
| `autoDetectUrls` | `boolean` | `true` | Transform bare platform URLs into chips |
|
|
191
|
+
| `transformMarkdownLinks` | `boolean` | `false` | Transform `[text](url)` links into chips |
|
|
192
|
+
| `classNames.chip` | `string` | `"entity-chip"` | CSS class for the chip wrapper |
|
|
193
|
+
| `classNames.favicon` | `string` | `"entity-favicon"` | CSS class for the favicon image |
|
|
194
|
+
| `classNames.name` | `string` | `"entity-name"` | CSS class for the label text |
|
|
195
|
+
|
|
196
|
+
## Supported Entities
|
|
197
|
+
|
|
198
|
+
The built-in database includes 200+ entities across categories:
|
|
199
|
+
|
|
200
|
+
| Category | Examples |
|
|
201
|
+
| -------------- | --------------------------------------------------------- |
|
|
202
|
+
| **Frameworks** | React, Vue, Angular, Svelte, Astro, Next.js, Tailwind CSS |
|
|
203
|
+
| **Dev Tools** | GitHub, GitLab, VS Code, Docker, Vite, ESLint |
|
|
204
|
+
| **AI** | OpenAI, Anthropic, Claude, Hugging Face |
|
|
205
|
+
| **Fintech** | Stripe, PayPal, Wise, Square |
|
|
206
|
+
| **Social** | YouTube, X, LinkedIn, Discord, Reddit |
|
|
207
|
+
| **Cloud** | AWS, Google Cloud, Azure, Vercel, Netlify, Cloudflare |
|
|
208
|
+
| **Databases** | PostgreSQL, MongoDB, Redis, Supabase, Firebase, Prisma |
|
|
209
|
+
| **SaaS** | Notion, Slack, Figma, Linear, Jira |
|
|
210
|
+
|
|
211
|
+
## Styling
|
|
212
|
+
|
|
213
|
+
Add CSS to style the chips:
|
|
214
|
+
|
|
215
|
+
```css
|
|
216
|
+
.entity-chip {
|
|
217
|
+
display: inline-flex;
|
|
218
|
+
align-items: center;
|
|
219
|
+
gap: 4px;
|
|
220
|
+
padding: 2px 8px;
|
|
221
|
+
border-radius: 16px;
|
|
222
|
+
background: #f0f0f0;
|
|
223
|
+
text-decoration: none;
|
|
224
|
+
color: #333;
|
|
225
|
+
font-size: 0.9em;
|
|
226
|
+
border: 1px solid #ddd;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.entity-chip:hover {
|
|
230
|
+
background: #e0e0e0;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.entity-favicon {
|
|
234
|
+
border-radius: 2px;
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Disclaimer
|
|
239
|
+
|
|
240
|
+
This project is not affiliated with, endorsed by, or sponsored by any of the companies or projects whose names or trademarks appear in the built-in entity database. All trademarks, logos, and brand names are the property of their respective owners and are used here solely for identification purposes.
|
|
241
|
+
|
|
242
|
+
Favicons are fetched at runtime via Google's public favicon service and are not bundled or redistributed with this package.
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/data/entities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,QAAA,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAysD3B,CAAC;AAEX,eAAe,QAAQ,CAAC"}
|