@@ -114,7 +114,7 @@ def render_annotation(self, el: str) -> str:
114
114
el:
115
115
An object representing a type annotation.
116
116
"""
117
- return el
117
+ return sanitize ( el )
118
118
119
119
@dispatch
120
120
def render_annotation (self , el : None ) -> str :
@@ -125,9 +125,9 @@ def render_annotation(self, el: expr.Name) -> str:
125
125
# TODO: maybe there is a way to get tabulate to handle this?
126
126
# unescaped pipes screw up table formatting
127
127
if self .render_interlinks :
128
- return f"[{ el .source } ](`{ el .full } `)"
128
+ return f"[{ sanitize ( el .source ) } ](`{ el .full } `)"
129
129
130
- return el .source
130
+ return sanitize ( el .source )
131
131
132
132
@dispatch
133
133
def render_annotation (self , el : expr .Expression ) -> str :
@@ -415,17 +415,19 @@ def render(self, el: dc.Parameter):
415
415
glob = ""
416
416
417
417
annotation = self .render_annotation (el .annotation )
418
+ name = sanitize (el .name )
419
+
418
420
if self .show_signature_annotations :
419
421
if annotation and has_default :
420
- res = f"{ glob } { el . name } : { annotation } = { el .default } "
422
+ res = f"{ glob } { name } : { annotation } = { el .default } "
421
423
elif annotation :
422
- res = f"{ glob } { el . name } : { annotation } "
424
+ res = f"{ glob } { name } : { annotation } "
423
425
elif has_default :
424
- res = f"{ glob } { el . name } ={ el .default } "
426
+ res = f"{ glob } { name } ={ el .default } "
425
427
else :
426
- res = f"{ glob } { el . name } "
428
+ res = f"{ glob } { name } "
427
429
428
- return sanitize ( res )
430
+ return res
429
431
430
432
# docstring parts -------------------------------------------------------------
431
433
@@ -471,7 +473,7 @@ def render(self, el: ds.DocstringSectionAttributes):
471
473
def render (self , el : ds .DocstringAttribute ):
472
474
row = [
473
475
sanitize (el .name ),
474
- sanitize ( self .render_annotation (el .annotation ) ),
476
+ self .render_annotation (el .annotation ),
475
477
sanitize (el .description or "" , allow_markdown = True ),
476
478
]
477
479
return row
0 commit comments