@@ -262,7 +262,7 @@ export class MarkdownDocumenter {
262
262
) ;
263
263
}
264
264
265
- this . _appendSection ( output , this . _processMarkdownContent ( tsdocComment . summarySection ) ) ;
265
+ this . _appendSection ( output , tsdocComment . summarySection ) ;
266
266
}
267
267
}
268
268
@@ -501,10 +501,7 @@ export class MarkdownDocumenter {
501
501
// Write the @remarks block
502
502
if ( tsdocComment . remarksBlock ) {
503
503
output . appendNode ( new DocHeading ( { configuration, title : 'Remarks' , level : 2 } ) ) ;
504
- this . _appendSection (
505
- output ,
506
- this . _processMarkdownContent ( tsdocComment . remarksBlock . content ) ,
507
- ) ;
504
+ this . _appendSection ( output , tsdocComment . remarksBlock . content ) ;
508
505
}
509
506
510
507
// Write the @example blocks
@@ -583,85 +580,15 @@ export class MarkdownDocumenter {
583
580
newContent . appendNode ( exampleBlock . content . nodes [ i ] ) ;
584
581
}
585
582
586
- this . _appendSection ( output , this . _processMarkdownContent ( newContent ) ) ;
583
+ this . _appendSection ( output , newContent ) ;
587
584
} else {
588
- this . _appendSection ( output , this . _processMarkdownContent ( exampleBlock . content ) ) ;
585
+ this . _appendSection ( output , exampleBlock . content ) ;
589
586
}
590
587
}
591
588
}
592
589
}
593
590
}
594
591
595
- private _processMarkdownContent ( content : DocSection ) : DocSection {
596
- const configuration : TSDocConfiguration = this . _tsdocConfiguration ;
597
- const processedSection : DocSection = new DocSection ( { configuration } ) ;
598
-
599
- // Process each node in the content
600
- for ( const node of content . nodes ) {
601
- if ( node . kind === DocNodeKind . Paragraph ) {
602
- const paragraph : DocParagraph = node as DocParagraph ;
603
- const processedParagraph : DocParagraph = new DocParagraph ( { configuration } ) ;
604
-
605
- // Process each child node in the paragraph
606
- for ( const child of paragraph . getChildNodes ( ) ) {
607
- if ( child . kind === DocNodeKind . PlainText || child . kind === DocNodeKind . EscapedText ) {
608
- const text : string =
609
- child . kind === DocNodeKind . PlainText
610
- ? ( child as DocPlainText ) . text
611
- : ( child as DocEscapedText ) . decodedText ;
612
-
613
- // Look for markdown links [text](url)
614
- const linkRegex : RegExp = / \[ ( [ ^ \] ] + ) \] \( ( [ ^ ) ] + ) \) / g;
615
- let lastIndex : number = 0 ;
616
- let match : RegExpExecArray | null ;
617
-
618
- while ( ( match = linkRegex . exec ( text ) ) !== null ) {
619
- // Add any text before the link
620
- if ( match . index > lastIndex ) {
621
- processedParagraph . appendNode (
622
- new DocPlainText ( {
623
- configuration,
624
- text : text . substring ( lastIndex , match . index ) ,
625
- } ) ,
626
- ) ;
627
- }
628
-
629
- // Add the link
630
- processedParagraph . appendNode (
631
- new DocLinkTag ( {
632
- configuration,
633
- tagName : '@link' ,
634
- linkText : match [ 1 ] ,
635
- urlDestination : match [ 2 ] ,
636
- } ) ,
637
- ) ;
638
-
639
- lastIndex = match . index + match [ 0 ] . length ;
640
- }
641
-
642
- // Add any remaining text
643
- if ( lastIndex < text . length ) {
644
- processedParagraph . appendNode (
645
- new DocPlainText ( {
646
- configuration,
647
- text : text . substring ( lastIndex ) ,
648
- } ) ,
649
- ) ;
650
- }
651
- } else {
652
- processedParagraph . appendNode ( child ) ;
653
- }
654
- }
655
-
656
- processedSection . appendNode ( processedParagraph ) ;
657
- } else {
658
- processedSection . appendNode ( node ) ;
659
- }
660
- }
661
-
662
- return processedSection ;
663
- }
664
-
665
592
private _writeThrowsSection ( output : DocSection , apiItem : ApiItem ) : void {
666
593
const configuration : TSDocConfiguration = this . _tsdocConfiguration ;
667
594
@@ -679,9 +606,7 @@ export class MarkdownDocumenter {
679
606
output . appendNode ( new DocHeading ( { configuration, title : heading } ) ) ;
680
607
681
608
for ( const throwsBlock of throwsBlocks ) {
682
- // Process throws blocks for markdown links
683
- const processedContent = this . _processMarkdownContent ( throwsBlock . content ) ;
684
- this . _appendSection ( output , processedContent ) ;
609
+ this . _appendSection ( output , throwsBlock . content ) ;
685
610
}
686
611
}
687
612
}
@@ -1283,10 +1208,7 @@ export class MarkdownDocumenter {
1283
1208
1284
1209
if ( apiParameterListMixin instanceof ApiDocumentedItem ) {
1285
1210
if ( apiParameterListMixin . tsdocComment ?. returnsBlock ) {
1286
- this . _appendSection (
1287
- output ,
1288
- this . _processMarkdownContent ( apiParameterListMixin . tsdocComment . returnsBlock . content ) ,
1289
- ) ;
1211
+ this . _appendSection ( output , apiParameterListMixin . tsdocComment . returnsBlock . content ) ;
1290
1212
}
1291
1213
}
1292
1214
@@ -1498,9 +1420,7 @@ export class MarkdownDocumenter {
1498
1420
1499
1421
if ( apiItem instanceof ApiDocumentedItem ) {
1500
1422
if ( apiItem . tsdocComment !== undefined ) {
1501
- // Process summary section for markdown links
1502
- const processedSummary = this . _processMarkdownContent ( apiItem . tsdocComment . summarySection ) ;
1503
- this . _appendAndMergeSection ( section , processedSummary ) ;
1423
+ this . _appendAndMergeSection ( section , apiItem . tsdocComment . summarySection ) ;
1504
1424
}
1505
1425
}
1506
1426
@@ -1674,11 +1594,7 @@ export class MarkdownDocumenter {
1674
1594
for ( const node of docSection . nodes ) {
1675
1595
if ( firstNode ) {
1676
1596
if ( node . kind === DocNodeKind . Paragraph ) {
1677
- // Process paragraph nodes for markdown links
1678
- const processedParagraph = this . _processMarkdownContent (
1679
- new DocSection ( { configuration : this . _tsdocConfiguration } , [ node ] ) ,
1680
- ) ;
1681
- output . appendNodesInParagraph ( processedParagraph . nodes [ 0 ] . getChildNodes ( ) ) ;
1597
+ output . appendNodesInParagraph ( node . getChildNodes ( ) ) ;
1682
1598
firstNode = false ;
1683
1599
continue ;
1684
1600
}
0 commit comments