@@ -59,7 +59,7 @@ class ParamRow:
59
59
def to_definition_list (self ):
60
60
name = self .name
61
61
anno = self .annotation
62
- desc = self .description
62
+ desc = sanitize ( self .description , allow_markdown = True )
63
63
default = sanitize (str (self .default ))
64
64
65
65
part_name = (
@@ -77,7 +77,7 @@ def to_definition_list(self):
77
77
# in the table display format, not description lists....
78
78
# by this stage _required_ is basically a special token to indicate
79
79
# a required argument.
80
- if default is not None :
80
+ if self . default is not None :
81
81
part_default_sep = Span (" = " , Attr (classes = ["parameter-default-sep" ]))
82
82
part_default = Span (default , Attr (classes = ["parameter-default" ]))
83
83
else :
@@ -100,13 +100,15 @@ def to_definition_list(self):
100
100
101
101
def to_tuple (self , style : Literal ["parameters" , "attributes" , "returns" ]):
102
102
name = self .name
103
+ description = sanitize (self .description , allow_markdown = True )
104
+
103
105
if style == "parameters" :
104
106
default = "_required_" if self .default is None else escape (self .default )
105
- return (name , self .annotation , self . description , default )
107
+ return (name , self .annotation , description , default )
106
108
elif style == "attributes" :
107
- return (name , self .annotation , self . description )
109
+ return (name , self .annotation , description )
108
110
elif style == "returns" :
109
- return (name , self .annotation , self . description )
111
+ return (name , self .annotation , description )
110
112
111
113
raise NotImplementedError (f"Unsupported table style: { style } " )
112
114
@@ -595,8 +597,9 @@ def render(self, el: ds.DocstringSectionParameters):
595
597
@dispatch
596
598
def render (self , el : ds .DocstringParameter ) -> ParamRow :
597
599
annotation = self .render_annotation (el .annotation )
598
- clean_desc = sanitize (el .description , allow_markdown = True )
599
- return ParamRow (el .name , clean_desc , annotation = annotation , default = el .default )
600
+ return ParamRow (
601
+ el .name , el .description , annotation = annotation , default = el .default
602
+ )
600
603
601
604
# attributes ----
602
605
@@ -611,7 +614,7 @@ def render(self, el: ds.DocstringSectionAttributes):
611
614
def render (self , el : ds .DocstringAttribute ) -> ParamRow :
612
615
return ParamRow (
613
616
el .name ,
614
- sanitize ( el .description or "" , allow_markdown = True ) ,
617
+ el .description or "" ,
615
618
annotation = self .render_annotation (el .annotation ),
616
619
)
617
620
@@ -680,7 +683,7 @@ def render(self, el: ds.DocstringReturn):
680
683
# similar to DocstringParameter, but no name or default
681
684
return ParamRow (
682
685
el .name ,
683
- sanitize ( el .description , allow_markdown = True ) ,
686
+ el .description ,
684
687
annotation = self .render_annotation (el .annotation ),
685
688
)
686
689
@@ -689,7 +692,7 @@ def render(self, el: ds.DocstringRaise) -> ParamRow:
689
692
# similar to DocstringParameter, but no name or default
690
693
return ParamRow (
691
694
None ,
692
- sanitize ( el .description , allow_markdown = True ) ,
695
+ el .description ,
693
696
annotation = self .render_annotation (el .annotation ),
694
697
)
695
698
0 commit comments