@@ -74,7 +74,7 @@ function getAnchor(data: ProjectReflection, id: number) {
7474}
7575
7676function link ( data , arg , text ) {
77- return `[${ text } ](#${ getAnchor ( data , arg . target ) } )` ;
77+ return `[${ sanitize ( text ) } ](#${ getAnchor ( data , arg . target ) } )` ;
7878}
7979
8080function stringifyObject ( type : ReflectionType ) {
@@ -97,6 +97,15 @@ function getPriority(item: Reflection) {
9797 return + ( tags . find ( ( item ) => item . tag === '@priority' ) ?. content [ 0 ] . text || 0 ) ;
9898}
9999
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+
100109async function typedocToMarkdown (
101110 data : ProjectReflection ,
102111 children : DeclarationReflection [ ] | undefined = [ ] ,
@@ -109,7 +118,7 @@ async function typedocToMarkdown(
109118 if ( parameters && parameters . length ) {
110119 markdown . push ( '| Parameter | Extends | Description |' ) ;
111120 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 } |` ) ) ;
113122 }
114123 }
115124 function throws ( ref : Reflection ) {
0 commit comments