@notehub.md/cli 0.1.6
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 +129 -0
- package/dist/commands/build.d.ts +30 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +202 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/create.d.ts +33 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +236 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -0
- package/templates/PLUGIN_GUIDE.md +599 -0
- package/templates/PLUGIN_GUIDE_RU.md +599 -0
- package/templates/docs.html +534 -0
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>Plugin Documentation | Notehub.md</title>
|
|
8
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
9
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
10
|
+
<link
|
|
11
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
|
|
12
|
+
rel="stylesheet">
|
|
13
|
+
<style>
|
|
14
|
+
:root {
|
|
15
|
+
--bg-primary: #0a0a0a;
|
|
16
|
+
--bg-secondary: #111111;
|
|
17
|
+
--bg-card: rgba(255, 255, 255, 0.03);
|
|
18
|
+
--bg-card-hover: rgba(255, 255, 255, 0.06);
|
|
19
|
+
--text-primary: #ffffff;
|
|
20
|
+
--text-secondary: rgba(255, 255, 255, 0.7);
|
|
21
|
+
--text-muted: rgba(255, 255, 255, 0.5);
|
|
22
|
+
--accent: #8b5cf6;
|
|
23
|
+
--accent-secondary: #a78bfa;
|
|
24
|
+
--border: rgba(255, 255, 255, 0.1);
|
|
25
|
+
--border-accent: rgba(139, 92, 246, 0.3);
|
|
26
|
+
--gradient-start: #8b5cf6;
|
|
27
|
+
--gradient-end: #06b6d4;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
* {
|
|
31
|
+
margin: 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
body {
|
|
37
|
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
38
|
+
background: var(--bg-primary);
|
|
39
|
+
color: var(--text-primary);
|
|
40
|
+
line-height: 1.6;
|
|
41
|
+
min-height: 100vh;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Background pattern */
|
|
45
|
+
body::before {
|
|
46
|
+
content: '';
|
|
47
|
+
position: fixed;
|
|
48
|
+
top: 0;
|
|
49
|
+
left: 0;
|
|
50
|
+
right: 0;
|
|
51
|
+
bottom: 0;
|
|
52
|
+
background:
|
|
53
|
+
radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 40%),
|
|
54
|
+
radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
|
|
55
|
+
pointer-events: none;
|
|
56
|
+
z-index: -1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.container {
|
|
60
|
+
max-width: 900px;
|
|
61
|
+
margin: 0 auto;
|
|
62
|
+
padding: 2rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Header */
|
|
66
|
+
header {
|
|
67
|
+
text-align: center;
|
|
68
|
+
padding: 4rem 0 3rem;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.logo {
|
|
72
|
+
width: 80px;
|
|
73
|
+
height: 80px;
|
|
74
|
+
margin-bottom: 1.5rem;
|
|
75
|
+
animation: float 3s ease-in-out infinite;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@keyframes float {
|
|
79
|
+
|
|
80
|
+
0%,
|
|
81
|
+
100% {
|
|
82
|
+
transform: translateY(0);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
50% {
|
|
86
|
+
transform: translateY(-8px);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
h1 {
|
|
91
|
+
font-size: 2.5rem;
|
|
92
|
+
font-weight: 700;
|
|
93
|
+
margin-bottom: 0.5rem;
|
|
94
|
+
background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
|
|
95
|
+
-webkit-background-clip: text;
|
|
96
|
+
-webkit-text-fill-color: transparent;
|
|
97
|
+
background-clip: text;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.subtitle {
|
|
101
|
+
color: var(--text-secondary);
|
|
102
|
+
font-size: 1.1rem;
|
|
103
|
+
font-weight: 400;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Language switcher */
|
|
107
|
+
.lang-switcher {
|
|
108
|
+
display: flex;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
gap: 0.5rem;
|
|
111
|
+
margin: 2rem 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.lang-btn {
|
|
115
|
+
padding: 0.5rem 1rem;
|
|
116
|
+
border: 1px solid var(--border);
|
|
117
|
+
background: var(--bg-card);
|
|
118
|
+
color: var(--text-secondary);
|
|
119
|
+
border-radius: 8px;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
font-family: inherit;
|
|
122
|
+
font-size: 0.9rem;
|
|
123
|
+
transition: all 0.2s ease;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.lang-btn:hover {
|
|
127
|
+
background: var(--bg-card-hover);
|
|
128
|
+
border-color: var(--border-accent);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.lang-btn.active {
|
|
132
|
+
background: var(--accent);
|
|
133
|
+
border-color: var(--accent);
|
|
134
|
+
color: white;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Cards */
|
|
138
|
+
.card {
|
|
139
|
+
background: var(--bg-card);
|
|
140
|
+
border: 1px solid var(--border);
|
|
141
|
+
border-radius: 16px;
|
|
142
|
+
padding: 2rem;
|
|
143
|
+
margin-bottom: 1.5rem;
|
|
144
|
+
backdrop-filter: blur(10px);
|
|
145
|
+
transition: all 0.3s ease;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.card:hover {
|
|
149
|
+
background: var(--bg-card-hover);
|
|
150
|
+
border-color: var(--border-accent);
|
|
151
|
+
transform: translateY(-2px);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.card h2 {
|
|
155
|
+
font-size: 1.3rem;
|
|
156
|
+
font-weight: 600;
|
|
157
|
+
margin-bottom: 1rem;
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
gap: 0.75rem;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.card h2 .icon {
|
|
164
|
+
font-size: 1.5rem;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.card p {
|
|
168
|
+
color: var(--text-secondary);
|
|
169
|
+
margin-bottom: 1rem;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* Code blocks */
|
|
173
|
+
pre {
|
|
174
|
+
background: var(--bg-secondary);
|
|
175
|
+
border: 1px solid var(--border);
|
|
176
|
+
border-radius: 8px;
|
|
177
|
+
padding: 1rem 1.25rem;
|
|
178
|
+
overflow-x: auto;
|
|
179
|
+
font-family: 'JetBrains Mono', monospace;
|
|
180
|
+
font-size: 0.85rem;
|
|
181
|
+
margin: 1rem 0;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
code {
|
|
185
|
+
font-family: 'JetBrains Mono', monospace;
|
|
186
|
+
color: var(--accent-secondary);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* Links */
|
|
190
|
+
.doc-links {
|
|
191
|
+
display: grid;
|
|
192
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
193
|
+
gap: 1rem;
|
|
194
|
+
margin-top: 1.5rem;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.doc-link {
|
|
198
|
+
display: flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
gap: 1rem;
|
|
201
|
+
padding: 1rem 1.25rem;
|
|
202
|
+
background: var(--bg-card);
|
|
203
|
+
border: 1px solid var(--border);
|
|
204
|
+
border-radius: 12px;
|
|
205
|
+
text-decoration: none;
|
|
206
|
+
color: var(--text-primary);
|
|
207
|
+
transition: all 0.2s ease;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.doc-link:hover {
|
|
211
|
+
background: var(--bg-card-hover);
|
|
212
|
+
border-color: var(--accent);
|
|
213
|
+
transform: translateX(4px);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.doc-link .flag {
|
|
217
|
+
font-size: 1.5rem;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.doc-link-text {
|
|
221
|
+
display: flex;
|
|
222
|
+
flex-direction: column;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.doc-link-title {
|
|
226
|
+
font-weight: 600;
|
|
227
|
+
font-size: 1rem;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.doc-link-desc {
|
|
231
|
+
color: var(--text-muted);
|
|
232
|
+
font-size: 0.85rem;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* File structure */
|
|
236
|
+
.file-tree {
|
|
237
|
+
font-family: 'JetBrains Mono', monospace;
|
|
238
|
+
font-size: 0.9rem;
|
|
239
|
+
color: var(--text-secondary);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.file-tree .folder {
|
|
243
|
+
color: var(--accent);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.file-tree .file {
|
|
247
|
+
color: var(--text-primary);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.file-tree .comment {
|
|
251
|
+
color: var(--text-muted);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* Footer */
|
|
255
|
+
footer {
|
|
256
|
+
text-align: center;
|
|
257
|
+
padding: 3rem 0;
|
|
258
|
+
color: var(--text-muted);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
footer a {
|
|
262
|
+
color: var(--accent);
|
|
263
|
+
text-decoration: none;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
footer a:hover {
|
|
267
|
+
text-decoration: underline;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* Language content */
|
|
271
|
+
[data-lang] {
|
|
272
|
+
display: none;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
[data-lang].active {
|
|
276
|
+
display: block;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/* Responsive */
|
|
280
|
+
@media (max-width: 600px) {
|
|
281
|
+
.container {
|
|
282
|
+
padding: 1rem;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
h1 {
|
|
286
|
+
font-size: 1.8rem;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.card {
|
|
290
|
+
padding: 1.5rem;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
</style>
|
|
294
|
+
</head>
|
|
295
|
+
|
|
296
|
+
<body>
|
|
297
|
+
<div class="container">
|
|
298
|
+
<header>
|
|
299
|
+
<svg class="logo" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
300
|
+
<rect width="512" height="512" rx="36" fill="black" />
|
|
301
|
+
<path d="M390.564 178.309V333.69L256 411.381L121.436 333.69V178.309L256 100.618L390.564 178.309Z"
|
|
302
|
+
stroke="white" stroke-width="8" />
|
|
303
|
+
<path d="M231.692 401.846C255.751 349.437 302.645 310.884 359.692 297.145" stroke="white"
|
|
304
|
+
stroke-width="4" />
|
|
305
|
+
<path
|
|
306
|
+
d="M373.755 294.3C380.541 293.183 387.45 292.411 394.461 292M394.461 292C394.508 291.997 393.846 291.975 394.461 292Z"
|
|
307
|
+
stroke="white" stroke-width="4" />
|
|
308
|
+
<path
|
|
309
|
+
d="M171.077 145.231C177.911 155.145 180.923 165.509 180.923 178.462C180.923 212.448 153.371 240 119.385 240"
|
|
310
|
+
stroke="white" stroke-width="4" />
|
|
311
|
+
<path d="M117.846 196.615C162.859 198.376 205.148 209.076 243.056 227.036" stroke="white"
|
|
312
|
+
stroke-width="4" />
|
|
313
|
+
<path d="M323.777 281.693C343.757 300.509 361.225 321.956 375.692 345.538" stroke="white"
|
|
314
|
+
stroke-width="4" />
|
|
315
|
+
<path d="M240.923 314.462C227.534 324.09 212.879 331.819 196.923 337.538" stroke="white"
|
|
316
|
+
stroke-width="4" />
|
|
317
|
+
<path
|
|
318
|
+
d="M308.615 208C310.377 198.153 311.077 188.336 311.077 177.846C311.077 158.72 310.819 143.66 305 126.5"
|
|
319
|
+
stroke="white" stroke-width="4" />
|
|
320
|
+
<path d="M175.385 344C164.998 346.478 154.609 347.952 143.692 348.615" stroke="white"
|
|
321
|
+
stroke-width="4" />
|
|
322
|
+
<path
|
|
323
|
+
d="M242.769 264.923C241.312 260.486 240.585 256.62 240.585 251.692C240.585 226.882 260.574 206.769 285.231 206.769C309.888 206.769 329.877 226.882 329.877 251.692C329.877 271.941 317.377 288.543 299.077 294.154"
|
|
324
|
+
stroke="white" stroke-width="3" />
|
|
325
|
+
<path
|
|
326
|
+
d="M238.596 268.923C236.471 263.368 235.692 258.001 235.692 251.692C235.692 224.163 257.872 201.846 285.231 201.846C312.59 201.846 334.769 224.163 334.769 251.692C334.769 275.044 319.388 294.281 297.846 299.692"
|
|
327
|
+
stroke="white" stroke-width="3" />
|
|
328
|
+
<circle cx="185.231" cy="339.077" r="11.6923" stroke="white" stroke-width="3" />
|
|
329
|
+
<circle cx="3.07692" cy="3.07692" r="3.07692" transform="matrix(-1 0 0 1 208 341.538)" fill="white" />
|
|
330
|
+
<circle cx="8" cy="8" r="8" transform="matrix(-1 0 0 1 374.769 287.385)" stroke="white"
|
|
331
|
+
stroke-width="3" />
|
|
332
|
+
<circle cx="6.15385" cy="6.15385" r="6.15385" transform="matrix(-1 0 0 1 290.462 180.308)"
|
|
333
|
+
stroke="white" stroke-width="4" />
|
|
334
|
+
<circle cx="264.923" cy="290.769" r="34.7692" stroke="white" stroke-width="4" />
|
|
335
|
+
</svg>
|
|
336
|
+
<h1 data-lang="en" class="active">Plugin Documentation</h1>
|
|
337
|
+
<h1 data-lang="ru">Документация плагина</h1>
|
|
338
|
+
<p class="subtitle" data-lang="en" class="active">Build powerful extensions for Notehub.md</p>
|
|
339
|
+
<p class="subtitle" data-lang="ru">Создавайте мощные расширения для Notehub.md</p>
|
|
340
|
+
</header>
|
|
341
|
+
|
|
342
|
+
<div class="lang-switcher">
|
|
343
|
+
<button class="lang-btn active" onclick="setLang('en')">🇬🇧 English</button>
|
|
344
|
+
<button class="lang-btn" onclick="setLang('ru')">🇷🇺 Русский</button>
|
|
345
|
+
</div>
|
|
346
|
+
|
|
347
|
+
<!-- ENGLISH CONTENT -->
|
|
348
|
+
<div data-lang="en" class="active">
|
|
349
|
+
<div class="card">
|
|
350
|
+
<h2><span class="icon">🚀</span> Quick Start</h2>
|
|
351
|
+
<p>Build your plugin in three simple steps:</p>
|
|
352
|
+
<pre><code># 1. Install dependencies
|
|
353
|
+
npm install
|
|
354
|
+
|
|
355
|
+
# 2. Build your plugin
|
|
356
|
+
npm run build
|
|
357
|
+
|
|
358
|
+
# 3. Package for distribution
|
|
359
|
+
npx @notehub.md/cli build</code></pre>
|
|
360
|
+
</div>
|
|
361
|
+
|
|
362
|
+
<div class="card">
|
|
363
|
+
<h2><span class="icon">📁</span> Plugin Structure</h2>
|
|
364
|
+
<div class="file-tree">
|
|
365
|
+
<p><span class="folder">your-plugin/</span></p>
|
|
366
|
+
<p>├── <span class="file">manifest.json</span> <span class="comment"># Plugin metadata</span></p>
|
|
367
|
+
<p>├── <span class="file">package.json</span> <span class="comment"># NPM config</span></p>
|
|
368
|
+
<p>├── <span class="file">tsconfig.json</span> <span class="comment"># TypeScript config</span></p>
|
|
369
|
+
<p>├── <span class="folder">src/</span></p>
|
|
370
|
+
<p>│ └── <span class="file">index.ts</span> <span class="comment"># Entry point</span></p>
|
|
371
|
+
<p>└── <span class="folder">docs/</span></p>
|
|
372
|
+
<p> └── <span class="file">index.html</span> <span class="comment"># This file</span></p>
|
|
373
|
+
</div>
|
|
374
|
+
</div>
|
|
375
|
+
|
|
376
|
+
<div class="card">
|
|
377
|
+
<h2><span class="icon">💡</span> API Example</h2>
|
|
378
|
+
<pre><code>import { NotehubPlugin, PluginContext } from '@notehub/api';
|
|
379
|
+
|
|
380
|
+
class MyPlugin extends NotehubPlugin {
|
|
381
|
+
async onload(ctx: PluginContext) {
|
|
382
|
+
// Register a custom API
|
|
383
|
+
ctx.registerApi('my-plugin:greet', (name: string) => {
|
|
384
|
+
return `Hello, ${name}!`;
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
// Subscribe to events
|
|
388
|
+
ctx.subscribe('explorer:file-selected', (payload) => {
|
|
389
|
+
console.log('Selected:', payload.path);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export default new MyPlugin();</code></pre>
|
|
395
|
+
</div>
|
|
396
|
+
|
|
397
|
+
<div class="card">
|
|
398
|
+
<h2><span class="icon">📚</span> Full Documentation</h2>
|
|
399
|
+
<p>Explore the complete plugin developer guide:</p>
|
|
400
|
+
<div class="doc-links">
|
|
401
|
+
<a href="https://github.com/khton-tech/notehub.md/tree/main/docs/forPluginMakers/en"
|
|
402
|
+
class="doc-link" target="_blank">
|
|
403
|
+
<span class="flag">🇬🇧</span>
|
|
404
|
+
<div class="doc-link-text">
|
|
405
|
+
<span class="doc-link-title">English Documentation</span>
|
|
406
|
+
<span class="doc-link-desc">Complete API reference & examples</span>
|
|
407
|
+
</div>
|
|
408
|
+
</a>
|
|
409
|
+
<a href="https://github.com/khton-tech/notehub.md/tree/main/docs/forPluginMakers/ru"
|
|
410
|
+
class="doc-link" target="_blank">
|
|
411
|
+
<span class="flag">🇷🇺</span>
|
|
412
|
+
<div class="doc-link-text">
|
|
413
|
+
<span class="doc-link-title">Документация на русском</span>
|
|
414
|
+
<span class="doc-link-desc">Полное руководство и примеры</span>
|
|
415
|
+
</div>
|
|
416
|
+
</a>
|
|
417
|
+
</div>
|
|
418
|
+
</div>
|
|
419
|
+
</div>
|
|
420
|
+
|
|
421
|
+
<!-- RUSSIAN CONTENT -->
|
|
422
|
+
<div data-lang="ru">
|
|
423
|
+
<div class="card">
|
|
424
|
+
<h2><span class="icon">🚀</span> Быстрый старт</h2>
|
|
425
|
+
<p>Соберите свой плагин в три простых шага:</p>
|
|
426
|
+
<pre><code># 1. Установите зависимости
|
|
427
|
+
npm install
|
|
428
|
+
|
|
429
|
+
# 2. Соберите плагин
|
|
430
|
+
npm run build
|
|
431
|
+
|
|
432
|
+
# 3. Упакуйте для распространения
|
|
433
|
+
npx @notehub.md/cli build</code></pre>
|
|
434
|
+
</div>
|
|
435
|
+
|
|
436
|
+
<div class="card">
|
|
437
|
+
<h2><span class="icon">📁</span> Структура плагина</h2>
|
|
438
|
+
<div class="file-tree">
|
|
439
|
+
<p><span class="folder">your-plugin/</span></p>
|
|
440
|
+
<p>├── <span class="file">manifest.json</span> <span class="comment"># Метаданные плагина</span></p>
|
|
441
|
+
<p>├── <span class="file">package.json</span> <span class="comment"># Конфиг NPM</span></p>
|
|
442
|
+
<p>├── <span class="file">tsconfig.json</span> <span class="comment"># Конфиг TypeScript</span></p>
|
|
443
|
+
<p>├── <span class="folder">src/</span></p>
|
|
444
|
+
<p>│ └── <span class="file">index.ts</span> <span class="comment"># Точка входа</span></p>
|
|
445
|
+
<p>└── <span class="folder">docs/</span></p>
|
|
446
|
+
<p> └── <span class="file">index.html</span> <span class="comment"># Этот файл</span></p>
|
|
447
|
+
</div>
|
|
448
|
+
</div>
|
|
449
|
+
|
|
450
|
+
<div class="card">
|
|
451
|
+
<h2><span class="icon">💡</span> Пример API</h2>
|
|
452
|
+
<pre><code>import { NotehubPlugin, PluginContext } from '@notehub/api';
|
|
453
|
+
|
|
454
|
+
class MyPlugin extends NotehubPlugin {
|
|
455
|
+
async onload(ctx: PluginContext) {
|
|
456
|
+
// Регистрация своего API
|
|
457
|
+
ctx.registerApi('my-plugin:greet', (name: string) => {
|
|
458
|
+
return `Привет, ${name}!`;
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
// Подписка на события
|
|
462
|
+
ctx.subscribe('explorer:file-selected', (payload) => {
|
|
463
|
+
console.log('Выбрано:', payload.path);
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export default new MyPlugin();</code></pre>
|
|
469
|
+
</div>
|
|
470
|
+
|
|
471
|
+
<div class="card">
|
|
472
|
+
<h2><span class="icon">📚</span> Полная документация</h2>
|
|
473
|
+
<p>Изучите полное руководство разработчика плагинов:</p>
|
|
474
|
+
<div class="doc-links">
|
|
475
|
+
<a href="https://github.com/khton-tech/notehub.md/tree/main/docs/forPluginMakers/ru"
|
|
476
|
+
class="doc-link" target="_blank">
|
|
477
|
+
<span class="flag">🇷🇺</span>
|
|
478
|
+
<div class="doc-link-text">
|
|
479
|
+
<span class="doc-link-title">Документация на русском</span>
|
|
480
|
+
<span class="doc-link-desc">Полное руководство и примеры</span>
|
|
481
|
+
</div>
|
|
482
|
+
</a>
|
|
483
|
+
<a href="https://github.com/khton-tech/notehub.md/tree/main/docs/forPluginMakers/en"
|
|
484
|
+
class="doc-link" target="_blank">
|
|
485
|
+
<span class="flag">🇬🇧</span>
|
|
486
|
+
<div class="doc-link-text">
|
|
487
|
+
<span class="doc-link-title">English Documentation</span>
|
|
488
|
+
<span class="doc-link-desc">Complete API reference & examples</span>
|
|
489
|
+
</div>
|
|
490
|
+
</a>
|
|
491
|
+
</div>
|
|
492
|
+
</div>
|
|
493
|
+
</div>
|
|
494
|
+
|
|
495
|
+
<footer>
|
|
496
|
+
<p>Made with ❤️ by <a href="https://github.com/khton-tech" target="_blank">khton-tech</a></p>
|
|
497
|
+
<p style="margin-top: 0.5rem;"><a href="https://github.com/khton-tech/notehub.md" target="_blank">Notehub.md
|
|
498
|
+
on GitHub</a></p>
|
|
499
|
+
</footer>
|
|
500
|
+
</div>
|
|
501
|
+
|
|
502
|
+
<script>
|
|
503
|
+
function setLang(lang) {
|
|
504
|
+
// Update buttons
|
|
505
|
+
document.querySelectorAll('.lang-btn').forEach(btn => {
|
|
506
|
+
btn.classList.remove('active');
|
|
507
|
+
if (btn.textContent.includes(lang === 'en' ? 'English' : 'Русский')) {
|
|
508
|
+
btn.classList.add('active');
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
// Update content
|
|
513
|
+
document.querySelectorAll('[data-lang]').forEach(el => {
|
|
514
|
+
el.classList.remove('active');
|
|
515
|
+
if (el.dataset.lang === lang) {
|
|
516
|
+
el.classList.add('active');
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// Save preference
|
|
521
|
+
localStorage.setItem('notehub-docs-lang', lang);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// Load saved language
|
|
525
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
526
|
+
const savedLang = localStorage.getItem('notehub-docs-lang');
|
|
527
|
+
if (savedLang) {
|
|
528
|
+
setLang(savedLang);
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
</script>
|
|
532
|
+
</body>
|
|
533
|
+
|
|
534
|
+
</html>
|