File tree Expand file tree Collapse file tree 3 files changed +87
-2
lines changed Expand file tree Collapse file tree 3 files changed +87
-2
lines changed Original file line number Diff line number Diff line change @@ -258,6 +258,7 @@ export function parseComment(
258
258
let inFencedCode = false ;
259
259
function readLine ( line : string ) {
260
260
line = line . replace ( / ^ \s * \* ? ? / , "" ) ;
261
+ const rawLine = line ;
261
262
line = line . replace ( / \s * $ / , "" ) ;
262
263
263
264
if ( CODE_FENCE . test ( line ) ) {
@@ -271,7 +272,12 @@ export function parseComment(
271
272
return readTagLine ( line , tag ) ;
272
273
}
273
274
}
274
- readBareLine ( line ) ;
275
+ if ( inFencedCode ) {
276
+ // This will not include code blocks declared with four spaces
277
+ readBareLine ( rawLine ) ;
278
+ } else {
279
+ readBareLine ( line ) ;
280
+ }
275
281
}
276
282
277
283
text = text . replace ( / ^ \s * \/ \* + / , "" ) ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * This is a comment containing a multiline code block
3
+ * ```ts
4
+ * export function multiply(a: number, b: number) {
5
+ * return a * b;
6
+ * }
7
+ * ```
8
+ * @module
9
+ */
10
+
11
+ export function multiply ( a : number , b : number ) {
12
+ return a * b ;
13
+ }
Original file line number Diff line number Diff line change 380
380
]
381
381
}
382
382
]
383
+ },
384
+ {
385
+ "id" : 42 ,
386
+ "name" : " comment4" ,
387
+ "kind" : 1 ,
388
+ "kindString" : " Module" ,
389
+ "flags" : {},
390
+ "comment" : {
391
+ "shortText" : " This is a comment containing a multiline code block\n ```ts\n export function multiply(a: number, b: number) {\n return a * b;\n }\n ```"
392
+ },
393
+ "children" : [
394
+ {
395
+ "id" : 43 ,
396
+ "name" : " multiply" ,
397
+ "kind" : 64 ,
398
+ "kindString" : " Function" ,
399
+ "flags" : {},
400
+ "signatures" : [
401
+ {
402
+ "id" : 44 ,
403
+ "name" : " multiply" ,
404
+ "kind" : 4096 ,
405
+ "kindString" : " Call signature" ,
406
+ "flags" : {},
407
+ "parameters" : [
408
+ {
409
+ "id" : 45 ,
410
+ "name" : " a" ,
411
+ "kind" : 32768 ,
412
+ "kindString" : " Parameter" ,
413
+ "flags" : {},
414
+ "type" : {
415
+ "type" : " intrinsic" ,
416
+ "name" : " number"
417
+ }
418
+ },
419
+ {
420
+ "id" : 46 ,
421
+ "name" : " b" ,
422
+ "kind" : 32768 ,
423
+ "kindString" : " Parameter" ,
424
+ "flags" : {},
425
+ "type" : {
426
+ "type" : " intrinsic" ,
427
+ "name" : " number"
428
+ }
429
+ }
430
+ ],
431
+ "type" : {
432
+ "type" : " intrinsic" ,
433
+ "name" : " number"
434
+ }
435
+ }
436
+ ]
437
+ }
438
+ ],
439
+ "groups" : [
440
+ {
441
+ "title" : " Functions" ,
442
+ "kind" : 64 ,
443
+ "children" : [
444
+ 43
445
+ ]
446
+ }
447
+ ]
383
448
}
384
449
],
385
450
"groups" : [
389
454
"children" : [
390
455
1 ,
391
456
32 ,
392
- 37
457
+ 37 ,
458
+ 42
393
459
]
394
460
}
395
461
]
You can’t perform that action at this time.
0 commit comments