@@ -74,7 +74,7 @@ function getAnchor(data: ProjectReflection, id: number) {
74
74
}
75
75
76
76
function link ( data , arg , text ) {
77
- return `[${ text } ](#${ getAnchor ( data , arg . target ) } )` ;
77
+ return `[${ sanitize ( text ) } ](#${ getAnchor ( data , arg . target ) } )` ;
78
78
}
79
79
80
80
function stringifyObject ( type : ReflectionType ) {
@@ -97,6 +97,15 @@ function getPriority(item: Reflection) {
97
97
return + ( tags . find ( ( item ) => item . tag === '@priority' ) ?. content [ 0 ] . text || 0 ) ;
98
98
}
99
99
100
+ function sanitize ( text : string ) {
101
+ return text
102
+ . replace ( / & / g, '&' )
103
+ . replace ( / < / g, '<' )
104
+ . replace ( / > / g, '>' )
105
+ . replace ( / " / g, '"' )
106
+ . replace ( / ' / g, ''' ) ;
107
+ }
108
+
100
109
async function typedocToMarkdown (
101
110
data : ProjectReflection ,
102
111
children : DeclarationReflection [ ] | undefined = [ ] ,
@@ -109,7 +118,7 @@ async function typedocToMarkdown(
109
118
if ( parameters && parameters . length ) {
110
119
markdown . push ( '| Parameter | Extends | Description |' ) ;
111
120
markdown . push ( '| ---- | ---- | ----------- |' ) ;
112
- parameters . forEach ( ( { name, type, comment } ) => markdown . push ( `| ${ name } | \`${ type || 'any' } \` | ${ comment } |` ) ) ;
121
+ parameters . forEach ( ( { name, type, comment } ) => markdown . push ( `| ${ name } | \`${ sanitize ( type ) || 'any' } \` | ${ comment } |` ) ) ;
113
122
}
114
123
}
115
124
function throws ( ref : Reflection ) {
0 commit comments