Skip to content

Commit a02a943

Browse files
committed
rustdoc: Write markdown for mod description
1 parent 3ebf7b4 commit a02a943

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/rustdoc/gen.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,36 @@ fn write_mod(
7171

7272
fn write_mod_contents(
7373
ctxt: ctxt,
74-
moddoc: doc::moddoc
74+
doc: doc::moddoc
7575
) {
76-
for fndoc in *moddoc.fns {
76+
write_brief(ctxt, doc.brief);
77+
write_desc(ctxt, doc.desc);
78+
79+
for fndoc in *doc.fns {
7780
subsection(ctxt) {||
7881
write_fn(ctxt, fndoc);
7982
}
8083
}
8184

82-
for moddoc in *moddoc.mods {
85+
for moddoc in *doc.mods {
8386
subsection(ctxt) {||
8487
write_mod(ctxt, moddoc);
8588
}
8689
}
8790
}
8891

92+
#[test]
93+
fn should_write_crate_brief_description() {
94+
let markdown = test::render("#[doc(brief = \"this is the crate\")];");
95+
assert str::contains(markdown, "this is the crate");
96+
}
97+
98+
#[test]
99+
fn should_write_crate_description() {
100+
let markdown = test::render("#[doc = \"this is the crate\"];");
101+
assert str::contains(markdown, "this is the crate");
102+
}
103+
89104
fn write_fn(
90105
ctxt: ctxt,
91106
doc: doc::fndoc

0 commit comments

Comments
 (0)