Skip to content

Commit 969b5c4

Browse files
committed
Render reST field lists through parsed blocks
1 parent 459af62 commit 969b5c4

5 files changed

Lines changed: 838 additions & 243 deletions

File tree

crates/ty_ide/src/docstring.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@ mod markdown;
1515
)
1616
)]
1717
mod parsed;
18+
mod preformatted;
1819
mod rest;
19-
#[cfg_attr(
20-
not(test),
21-
expect(
22-
dead_code,
23-
reason = "wired into parsed docstring rendering in follow-up changes"
24-
)
25-
)]
2620
mod sections;
2721

2822
use indexmap::IndexMap;
@@ -1987,12 +1981,14 @@ mod tests {
19871981
assert_snapshot!(docstring.render_markdown(), @"
19881982
This is a function description.<HB>
19891983
<HB>
1990-
:param str param1: The first parameter description<HB>
1991-
:param int param2: The second parameter description<HB>
1984+
## Parameters<HB>
1985+
`param1` (`str`): The first parameter description<HB>
1986+
`param2` (`int`): The second parameter description<HB>
19921987
&nbsp;&nbsp;&nbsp;&nbsp;This is a continuation of param2 description.<HB>
1993-
:param param3: A parameter without type annotation<HB>
1994-
:returns: The return value description<HB>
1995-
:rtype: str
1988+
`param3`: A parameter without type annotation<HB>
1989+
<HB>
1990+
## Returns<HB>
1991+
`str`: The return value description
19961992
");
19971993
}
19981994

@@ -2056,8 +2052,9 @@ mod tests {
20562052
Args:<HB>
20572053
&nbsp;&nbsp;&nbsp;&nbsp;param1 (str): Google-style parameter<HB>
20582054
<HB>
2059-
:param int param2: reST-style parameter<HB>
2060-
:param param3: Another reST-style parameter<HB>
2055+
## Parameters<HB>
2056+
`param2` (`int`): reST-style parameter<HB>
2057+
`param3`: Another reST-style parameter<HB>
20612058
<HB>
20622059
Parameters<HB>
20632060
----------<HB>

0 commit comments

Comments
 (0)