@fsegurai/marked-extended-comments 17.0.0-beta.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.custom.md +600 -0
- package/README.md +682 -0
- package/dist/index.cjs +498 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.esm.js +496 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/renderer.d.ts +27 -0
- package/dist/tokenizer.d.ts +18 -0
- package/dist/types.d.ts +147 -0
- package/dist/utils/constants.d.ts +29 -0
- package/dist/utils/helpers.d.ts +30 -0
- package/dist/utils/inject-styles.d.ts +4 -0
- package/package.json +53 -0
- package/src/global.d.ts +13 -0
- package/src/index.ts +103 -0
- package/src/renderer.ts +126 -0
- package/src/tokenizer.ts +161 -0
- package/src/types.ts +172 -0
- package/src/utils/constants.ts +115 -0
- package/src/utils/helpers.ts +138 -0
- package/src/utils/inject-styles.ts +15 -0
package/README.custom.md
ADDED
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
<!-- SECTION:CUSTOM_INTRO -->
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
This extension enables powerful commenting capabilities directly in Markdown, allowing teams to annotate documents,
|
|
5
|
+
track feedback, manage review processes, and collaborate on content creation. Comments can be styled by type, filtered
|
|
6
|
+
by status, and customized to fit your workflow.
|
|
7
|
+
|
|
8
|
+
<!-- SECTION:CUSTOM_TOC_USAGE -->
|
|
9
|
+
|
|
10
|
+
- [Inline Comments](#inline-comments)
|
|
11
|
+
- [Block Comments](#block-comments)
|
|
12
|
+
|
|
13
|
+
- [Comment Types](#comment-types)
|
|
14
|
+
- [Configuration Options](#configuration-options)
|
|
15
|
+
- [Properties](#properties)
|
|
16
|
+
- [Advanced Examples](#advanced-examples)
|
|
17
|
+
|
|
18
|
+
<!-- SECTION:CUSTOM_BASIC_USAGE -->
|
|
19
|
+
**Comments use two syntaxes: `:::comment` for inline and `::::comment` for block comments.**
|
|
20
|
+
|
|
21
|
+
<!-- SECTION:CUSTOM_USAGE_EXAMPLE -->
|
|
22
|
+
const markdown = `
|
|
23
|
+
This text has :::comment{author="Alice"}a note::: embedded inline.
|
|
24
|
+
|
|
25
|
+
::::comment{author="Bob" type="review" status="open"}
|
|
26
|
+
This section needs revision.
|
|
27
|
+
|
|
28
|
+
**Action items:**
|
|
29
|
+
|
|
30
|
+
- Verify statistics
|
|
31
|
+
- Add citations
|
|
32
|
+
::::commentend
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
marked.parse(markdown);
|
|
36
|
+
|
|
37
|
+
<!-- SECTION:CUSTOM_USAGE_NOTES -->
|
|
38
|
+
The extension supports **nested Markdown content** within block comments, including lists, code blocks, links, and all
|
|
39
|
+
other Markdown formatting. Comments are rendered with semantic HTML and include proper accessibility attributes.
|
|
40
|
+
|
|
41
|
+
### Styling Your Comments
|
|
42
|
+
|
|
43
|
+
This extension follows a **separation of concerns** approach, injecting only minimal structural CSS. Visual styling is
|
|
44
|
+
completely separated for maximum flexibility.
|
|
45
|
+
|
|
46
|
+
#### Generated HTML Structure
|
|
47
|
+
|
|
48
|
+
**Inline Comments:**
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<span class="marked-extended-comment marked-extended-comment-inline marked-extended-comment-type-note">
|
|
52
|
+
<span class="marked-extended-comment-indicator" title="Comment by Alice">💬</span>
|
|
53
|
+
<span class="marked-extended-comment-text">inline text</span>
|
|
54
|
+
</span>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Block Comments:**
|
|
58
|
+
|
|
59
|
+
```html
|
|
60
|
+
|
|
61
|
+
<div class="marked-extended-comment marked-extended-comment-block marked-extended-comment-type-review">
|
|
62
|
+
<div class="marked-extended-comment-header">
|
|
63
|
+
<span class="marked-extended-comment-icon">💬</span>
|
|
64
|
+
<span class="marked-extended-comment-type-label">Review</span>
|
|
65
|
+
<span class="marked-extended-comment-metadata">
|
|
66
|
+
<span class="marked-extended-comment-author">By Alice</span>
|
|
67
|
+
<span class="marked-extended-comment-status">Open</span>
|
|
68
|
+
</span>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="marked-extended-comment-body">
|
|
71
|
+
<!-- Markdown content rendered here -->
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### CSS Classes Reference
|
|
77
|
+
|
|
78
|
+
| Class | Purpose | Type |
|
|
79
|
+
|--------------------------------------------|-------------------------|--------|
|
|
80
|
+
| `.marked-extended-comment` | Base comment wrapper | Both |
|
|
81
|
+
| `.marked-extended-comment-inline` | Inline comment style | Inline |
|
|
82
|
+
| `.marked-extended-comment-block` | Block comment style | Block |
|
|
83
|
+
| `.marked-extended-comment-type-note` | Note type styling | Both |
|
|
84
|
+
| `.marked-extended-comment-type-review` | Review type styling | Both |
|
|
85
|
+
| `.marked-extended-comment-type-question` | Question type styling | Both |
|
|
86
|
+
| `.marked-extended-comment-type-suggestion` | Suggestion type styling | Both |
|
|
87
|
+
| `.marked-extended-comment-indicator` | Inline comment icon | Inline |
|
|
88
|
+
| `.marked-extended-comment-text` | Inline comment text | Inline |
|
|
89
|
+
| `.marked-extended-comment-header` | Block comment header | Block |
|
|
90
|
+
| `.marked-extended-comment-icon` | Block comment icon | Block |
|
|
91
|
+
| `.marked-extended-comment-type-label` | Type label text | Block |
|
|
92
|
+
| `.marked-extended-comment-metadata` | Author/status info | Block |
|
|
93
|
+
| `.marked-extended-comment-body` | Block comment content | Block |
|
|
94
|
+
|
|
95
|
+
#### Complete Styling Example
|
|
96
|
+
|
|
97
|
+
```css
|
|
98
|
+
/* Base comment styles */
|
|
99
|
+
.marked-extended-comment {
|
|
100
|
+
transition: all 0.2s ease;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Inline Comments */
|
|
104
|
+
.marked-extended-comment-inline {
|
|
105
|
+
background: rgba(255, 235, 59, 0.2);
|
|
106
|
+
border-bottom: 2px dashed rgba(255, 235, 59, 0.8);
|
|
107
|
+
padding: 0 4px;
|
|
108
|
+
cursor: help;
|
|
109
|
+
border-radius: 2px;
|
|
110
|
+
position: relative;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.marked-extended-comment-inline:hover {
|
|
114
|
+
background: rgba(255, 235, 59, 0.3);
|
|
115
|
+
border-bottom-color: rgba(255, 235, 59, 1);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.marked-extended-comment-indicator {
|
|
119
|
+
font-size: 0.875em;
|
|
120
|
+
opacity: 0.8;
|
|
121
|
+
margin-right: 2px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Block Comments */
|
|
125
|
+
.marked-extended-comment-block {
|
|
126
|
+
padding: 1rem;
|
|
127
|
+
margin: 1rem 0;
|
|
128
|
+
border-left: 4px solid;
|
|
129
|
+
border-radius: 4px;
|
|
130
|
+
background: rgba(0, 0, 0, 0.03);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.marked-extended-comment-header {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
gap: 0.5rem;
|
|
137
|
+
margin-bottom: 0.75rem;
|
|
138
|
+
padding-bottom: 0.5rem;
|
|
139
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.marked-extended-comment-icon {
|
|
143
|
+
font-size: 1.2em;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.marked-extended-comment-type-label {
|
|
147
|
+
font-weight: 600;
|
|
148
|
+
text-transform: uppercase;
|
|
149
|
+
letter-spacing: 0.05em;
|
|
150
|
+
font-size: 0.875rem;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.marked-extended-comment-metadata {
|
|
154
|
+
margin-left: auto;
|
|
155
|
+
display: flex;
|
|
156
|
+
gap: 0.75rem;
|
|
157
|
+
font-size: 0.75rem;
|
|
158
|
+
color: rgba(0, 0, 0, 0.6);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.marked-extended-comment-body {
|
|
162
|
+
line-height: 1.6;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* Comment Types - Note */
|
|
166
|
+
.marked-extended-comment-type-note {
|
|
167
|
+
border-color: #2196F3;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.marked-extended-comment-type-note.marked-extended-comment-inline {
|
|
171
|
+
background: rgba(33, 150, 243, 0.15);
|
|
172
|
+
border-bottom-color: rgba(33, 150, 243, 0.6);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.marked-extended-comment-type-note.marked-extended-comment-block {
|
|
176
|
+
background: rgba(33, 150, 243, 0.05);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.marked-extended-comment-type-note .marked-extended-comment-type-label {
|
|
180
|
+
color: #2196F3;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* Comment Types - Review */
|
|
184
|
+
.marked-extended-comment-type-review {
|
|
185
|
+
border-color: #9C27B0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.marked-extended-comment-type-review.marked-extended-comment-inline {
|
|
189
|
+
background: rgba(156, 39, 176, 0.15);
|
|
190
|
+
border-bottom-color: rgba(156, 39, 176, 0.6);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.marked-extended-comment-type-review.marked-extended-comment-block {
|
|
194
|
+
background: rgba(156, 39, 176, 0.05);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.marked-extended-comment-type-review .marked-extended-comment-type-label {
|
|
198
|
+
color: #9C27B0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* Comment Types - Question */
|
|
202
|
+
.marked-extended-comment-type-question {
|
|
203
|
+
border-color: #FF9800;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.marked-extended-comment-type-question.marked-extended-comment-inline {
|
|
207
|
+
background: rgba(255, 152, 0, 0.15);
|
|
208
|
+
border-bottom-color: rgba(255, 152, 0, 0.6);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.marked-extended-comment-type-question.marked-extended-comment-block {
|
|
212
|
+
background: rgba(255, 152, 0, 0.05);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.marked-extended-comment-type-question .marked-extended-comment-type-label {
|
|
216
|
+
color: #FF9800;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* Comment Types - Suggestion */
|
|
220
|
+
.marked-extended-comment-type-suggestion {
|
|
221
|
+
border-color: #4CAF50;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.marked-extended-comment-type-suggestion.marked-extended-comment-inline {
|
|
225
|
+
background: rgba(76, 175, 80, 0.15);
|
|
226
|
+
border-bottom-color: rgba(76, 175, 80, 0.6);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.marked-extended-comment-type-suggestion.marked-extended-comment-block {
|
|
230
|
+
background: rgba(76, 175, 80, 0.05);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.marked-extended-comment-type-suggestion .marked-extended-comment-type-label {
|
|
234
|
+
color: #4CAF50;
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### Dark Mode Support
|
|
239
|
+
|
|
240
|
+
```css
|
|
241
|
+
/* Light theme */
|
|
242
|
+
body.light .marked-extended-comment-block {
|
|
243
|
+
background: rgba(0, 0, 0, 0.03);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
body.light .marked-extended-comment-metadata {
|
|
247
|
+
color: rgba(0, 0, 0, 0.6);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
body.light .marked-extended-comment-body {
|
|
251
|
+
color: #24292e;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* Dark theme */
|
|
255
|
+
body.dark .marked-extended-comment-block {
|
|
256
|
+
background: rgba(255, 255, 255, 0.05);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
body.dark .marked-extended-comment-metadata {
|
|
260
|
+
color: rgba(255, 255, 255, 0.6);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
body.dark .marked-extended-comment-body {
|
|
264
|
+
color: #d1d5da;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
body.dark .marked-extended-comment-header {
|
|
268
|
+
border-bottom-color: rgba(255, 255, 255, 0.1);
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
#### SVG Icon Styling
|
|
273
|
+
|
|
274
|
+
The extension uses SVG icons for each comment type. You can customize their appearance:
|
|
275
|
+
|
|
276
|
+
```css
|
|
277
|
+
/* Base SVG icon styling */
|
|
278
|
+
.comment-icon {
|
|
279
|
+
display: inline-block;
|
|
280
|
+
vertical-align: middle;
|
|
281
|
+
width: 16px;
|
|
282
|
+
height: 16px;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/* Larger icons in block comment headers */
|
|
286
|
+
.marked-extended-comment-icon .comment-icon {
|
|
287
|
+
width: 20px;
|
|
288
|
+
height: 20px;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/* Smaller icons for inline comments */
|
|
292
|
+
.marked-extended-comment-indicator .comment-icon {
|
|
293
|
+
width: 14px;
|
|
294
|
+
height: 14px;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* Color icons by comment type */
|
|
298
|
+
.marked-extended-comment-type-note .comment-icon {
|
|
299
|
+
color: #2196F3;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.marked-extended-comment-type-question .comment-icon {
|
|
303
|
+
color: #9C27B0;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.marked-extended-comment-type-suggestion .comment-icon {
|
|
307
|
+
color: #4CAF50;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.marked-extended-comment-type-issue .comment-icon {
|
|
311
|
+
color: #F44336;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.marked-extended-comment-type-internal .comment-icon {
|
|
315
|
+
color: #607D8B;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.marked-extended-comment-type-review .comment-icon {
|
|
319
|
+
color: #FF9800;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.marked-extended-comment-type-todo .comment-icon {
|
|
323
|
+
color: #00BCD4;
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
#### Status-Based Styling
|
|
328
|
+
|
|
329
|
+
```css
|
|
330
|
+
/* Status indicators */
|
|
331
|
+
.marked-extended-comment-status {
|
|
332
|
+
padding: 2px 6px;
|
|
333
|
+
border-radius: 3px;
|
|
334
|
+
font-weight: 600;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.marked-extended-comment[data-status="open"] .marked-extended-comment-status {
|
|
338
|
+
background: #22863a;
|
|
339
|
+
color: white;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.marked-extended-comment[data-status="resolved"] .marked-extended-comment-status {
|
|
343
|
+
background: #6f42c1;
|
|
344
|
+
color: white;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.marked-extended-comment[data-status="pending"] .marked-extended-comment-status {
|
|
348
|
+
background: #f66a0a;
|
|
349
|
+
color: white;
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
#### Tooltip for Inline Comments
|
|
354
|
+
|
|
355
|
+
```css
|
|
356
|
+
/* Add tooltip on hover */
|
|
357
|
+
.marked-extended-comment-inline::after {
|
|
358
|
+
content: attr(title);
|
|
359
|
+
position: absolute;
|
|
360
|
+
bottom: 100%;
|
|
361
|
+
left: 50%;
|
|
362
|
+
transform: translateX(-50%);
|
|
363
|
+
background: #333;
|
|
364
|
+
color: white;
|
|
365
|
+
padding: 4px 8px;
|
|
366
|
+
border-radius: 4px;
|
|
367
|
+
font-size: 0.75rem;
|
|
368
|
+
white-space: nowrap;
|
|
369
|
+
opacity: 0;
|
|
370
|
+
pointer-events: none;
|
|
371
|
+
transition: opacity 0.2s;
|
|
372
|
+
margin-bottom: 4px;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.marked-extended-comment-inline:hover::after {
|
|
376
|
+
opacity: 1;
|
|
377
|
+
}
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
#### Copy Demo Theme
|
|
381
|
+
|
|
382
|
+
For complete
|
|
383
|
+
styling: [comment-theme.css](https://github.com/fsegurai/marked-extensions/blob/main/demo/styles/extensions/comment-theme.css)
|
|
384
|
+
|
|
385
|
+
Check the [demo](https://fsegurai.github.io/marked-extensions) to see all comment types and styles in action.
|
|
386
|
+
|
|
387
|
+
<!-- SECTION:CUSTOM_SECTIONS -->2. **Use CSS variables** for customization
|
|
388
|
+
|
|
389
|
+
3. **Write your own CSS** targeting comment classes
|
|
390
|
+
|
|
391
|
+
The theme file includes styles for all comment types, statuses, visibility levels, and priorities. Check
|
|
392
|
+
the [demo](https://fsegurai.github.io/marked-extensions) to see it in action.
|
|
393
|
+
|
|
394
|
+
<!-- SECTION:CUSTOM_SECTIONS -->
|
|
395
|
+
|
|
396
|
+
### Inline Comments
|
|
397
|
+
|
|
398
|
+
Inline comments appear directly within text, perfect for quick annotations:
|
|
399
|
+
|
|
400
|
+
```markdown
|
|
401
|
+
This text has :::comment{author="Alice" type="note"}needs verification::: here.
|
|
402
|
+
|
|
403
|
+
A question: :::comment{type="question"}should we use v2 API?:::
|
|
404
|
+
|
|
405
|
+
Mark as :::comment{type="issue"}outdated data::: for review.
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Block Comments
|
|
409
|
+
|
|
410
|
+
Block comments are standalone sections with full Markdown support:
|
|
411
|
+
|
|
412
|
+
```markdown
|
|
413
|
+
::::comment{author="Editor" type="review" priority="high"}
|
|
414
|
+
This introduction needs strengthening.
|
|
415
|
+
|
|
416
|
+
**Suggestions:**
|
|
417
|
+
|
|
418
|
+
- Add a hook to grab reader attention
|
|
419
|
+
- Include recent statistics
|
|
420
|
+
- Mention the main thesis upfront
|
|
421
|
+
::::commentend
|
|
422
|
+
|
|
423
|
+
::::comment{type="internal" visibility="dev-only"}
|
|
424
|
+
**Developer Note:**
|
|
425
|
+
|
|
426
|
+
TODO: Update after API v2 release.
|
|
427
|
+
Use `/api/v2/data` endpoint.
|
|
428
|
+
::::commentend
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## Comment Types
|
|
432
|
+
|
|
433
|
+
The extension supports 7 comment types with automatic SVG icons and color coding:
|
|
434
|
+
|
|
435
|
+
| Type | Icon | Description | Color | Use Case |
|
|
436
|
+
|--------------|------|-------------------------|--------|------------------------------|
|
|
437
|
+
| `note` | 📄 | General annotations | Blue | Documentation, clarification |
|
|
438
|
+
| `question` | ❔ | Questions and queries | Purple | Requesting information |
|
|
439
|
+
| `suggestion` | 💡 | Improvement suggestions | Green | Recommendations, ideas |
|
|
440
|
+
| `issue` | ⚠️ | Problems and bugs | Red | Critical items, errors |
|
|
441
|
+
| `internal` | 🔒 | Internal notes | Grey | Private team notes |
|
|
442
|
+
| `review` | 👁️ | Review comments | Orange | Editorial feedback |
|
|
443
|
+
| `todo` | ✓ | Action items | Cyan | Task tracking |
|
|
444
|
+
|
|
445
|
+
Each type is automatically styled with appropriate colors and SVG icons. You can set a default type in configuration.
|
|
446
|
+
|
|
447
|
+
### Configuration Options
|
|
448
|
+
|
|
449
|
+
The marked-extended-comments extension accepts the following configuration options:
|
|
450
|
+
|
|
451
|
+
- `className`: The base CSS class name for comments. Defaults to 'marked-extended-comment.'
|
|
452
|
+
- `prefixId`: The prefix ID for comment elements. Defaults to 'comment'.
|
|
453
|
+
- `showComments`: Whether to display comments. Defaults to true.
|
|
454
|
+
- `enableInlineComments`: Enable inline comment syntax. Defaults to true.
|
|
455
|
+
- `enableBlockComments`: Enable block comment syntax. Defaults to true.
|
|
456
|
+
- `showMetadata`: Display comment metadata (author, date, tags). Defaults to true.
|
|
457
|
+
- `showResolvedComments`: Show comments marked as resolved. Defaults to false.
|
|
458
|
+
- `defaultType`: Default comment type when not specified. Defaults to 'note'.
|
|
459
|
+
- `defaultVisibility`: Default visibility level. Defaults to 'public'.
|
|
460
|
+
- `injectStyles`: Whether to inject default styles. Defaults to true.
|
|
461
|
+
- `customizeToken`: Function to customize comment tokens. Defaults to null.
|
|
462
|
+
- `onVisibilityChange`: Callback when comment visibility changes. Defaults to null.
|
|
463
|
+
- `onStatusChange`: Callback when comment status changes. Defaults to null.
|
|
464
|
+
- `inlineTemplate`: Custom HTML template for inline comments. Defaults to built-in template.
|
|
465
|
+
- `blockTemplate`: Custom HTML template for block comments. Defaults to built-in template.
|
|
466
|
+
|
|
467
|
+
### Properties
|
|
468
|
+
|
|
469
|
+
Comment syntax supports the following properties:
|
|
470
|
+
|
|
471
|
+
**Common Properties:**
|
|
472
|
+
|
|
473
|
+
- `author`: Comment author name
|
|
474
|
+
- `date`: ISO date string (e.g., "2026-02-07")
|
|
475
|
+
- `type`: Comment type ('note', 'question', 'suggestion', 'issue', 'internal', 'review', 'todo')
|
|
476
|
+
- `status`: Comment status ('open', 'resolved', 'archived'). Defaults to 'open'.
|
|
477
|
+
- `visibility`: Visibility level ('public', 'private', 'dev-only', 'editors-only'). Defaults to 'public'.
|
|
478
|
+
- `priority`: Priority level ('low', 'medium', 'high')
|
|
479
|
+
- `tags`: Comma-separated tags
|
|
480
|
+
- `id`: Custom identifier for the comment
|
|
481
|
+
|
|
482
|
+
**Block Comment Properties:**
|
|
483
|
+
|
|
484
|
+
- `replyTo`: ID of parent comment for threading
|
|
485
|
+
|
|
486
|
+
**Example with properties:**
|
|
487
|
+
|
|
488
|
+
```markdown
|
|
489
|
+
::::comment{
|
|
490
|
+
author="Alice Smith"
|
|
491
|
+
date="2026-02-07"
|
|
492
|
+
type="review"
|
|
493
|
+
status="open"
|
|
494
|
+
priority="high"
|
|
495
|
+
tags="urgent,milestone"
|
|
496
|
+
id="comment-123"
|
|
497
|
+
}
|
|
498
|
+
Review this section carefully before release.
|
|
499
|
+
::::commentend
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### Advanced Examples
|
|
503
|
+
|
|
504
|
+
#### Editorial Workflow
|
|
505
|
+
|
|
506
|
+
```markdown
|
|
507
|
+
::::comment{author="Chief Editor" type="review" priority="high"}
|
|
508
|
+
This introduction lacks impact. Consider:
|
|
509
|
+
|
|
510
|
+
1. Start with a compelling statistic
|
|
511
|
+
2. Include a real-world example
|
|
512
|
+
3. State the main argument upfront
|
|
513
|
+
|
|
514
|
+
**Deadline:** End of week
|
|
515
|
+
::::commentend
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
#### Code Review Process
|
|
519
|
+
|
|
520
|
+
```markdown
|
|
521
|
+
::::comment{author="Senior Dev" type="issue" status="open"}
|
|
522
|
+
This function has a potential memory leak in the event handler.
|
|
523
|
+
|
|
524
|
+
:::comment{type="suggestion"}Consider using WeakMap for automatic cleanup:::
|
|
525
|
+
|
|
526
|
+
**Priority:** Must fix before merge
|
|
527
|
+
::::commentend
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
#### Documentation Feedback
|
|
531
|
+
|
|
532
|
+
```markdown
|
|
533
|
+
The API endpoint :::comment{type="question"}returns JSON or XML?::: can be called with optional parameters.
|
|
534
|
+
|
|
535
|
+
::::comment{type="note" author="API Team"}
|
|
536
|
+
**Note:** This endpoint will be deprecated in v3.0.
|
|
537
|
+
|
|
538
|
+
Migration guide: [link to docs]
|
|
539
|
+
::::commentend
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
#### Task Management
|
|
543
|
+
|
|
544
|
+
```markdown
|
|
545
|
+
::::comment{type="todo" author="Project Manager" tags="sprint-5,docs"}
|
|
546
|
+
**Sprint Tasks:**
|
|
547
|
+
|
|
548
|
+
- [ ] Complete API documentation
|
|
549
|
+
- [ ] Add code examples
|
|
550
|
+
- [ ] Review with team
|
|
551
|
+
- [ ] Update changelog
|
|
552
|
+
|
|
553
|
+
*Due:* End of sprint
|
|
554
|
+
::::commentend
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
#### Internal Notes
|
|
558
|
+
|
|
559
|
+
```markdown
|
|
560
|
+
::::comment{type="internal" visibility="dev-only"}
|
|
561
|
+
**Implementation Details:**
|
|
562
|
+
|
|
563
|
+
This is a temporary workaround until the upstream library fixes the bug.
|
|
564
|
+
Expected fix in v2.1.0 (Q2 2026).
|
|
565
|
+
|
|
566
|
+
See issue #1234 for tracking.
|
|
567
|
+
::::commentend
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
#### Status Tracking
|
|
571
|
+
|
|
572
|
+
```markdown
|
|
573
|
+
::::comment{author="Alice" type="issue" status="resolved"}
|
|
574
|
+
~~The calculation was incorrect.~~
|
|
575
|
+
|
|
576
|
+
**Resolution:** Fixed in commit abc123
|
|
577
|
+
Formula updated to use correct constant.
|
|
578
|
+
::::commentend
|
|
579
|
+
|
|
580
|
+
::::comment{type="note" status="archived"}
|
|
581
|
+
Old implementation notes - kept for historical reference.
|
|
582
|
+
::::commentend
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
#### Visibility Control
|
|
586
|
+
|
|
587
|
+
```markdown
|
|
588
|
+
::::comment{visibility="private"}
|
|
589
|
+
Private note only visible to authorized users.
|
|
590
|
+
::::commentend
|
|
591
|
+
|
|
592
|
+
::::comment{visibility="editors-only"}
|
|
593
|
+
Editorial team: Please review for tone and style.
|
|
594
|
+
::::commentend
|
|
595
|
+
|
|
596
|
+
::::comment{visibility="dev-only"}
|
|
597
|
+
Technical debt: Refactor this section when time permits.
|
|
598
|
+
::::commentend
|
|
599
|
+
```
|
|
600
|
+
|