Oliver Middleton
7298dabdb3
rustdoc: Stop stripping empty modules
...
There is no good reason to strip empty modules with no documentation and
doing so causes subtle problems.
2017-06-11 18:26:01 +01:00
Oliver Middleton
577c059d50
rustdoc: Use create_dir_all to create output directory
...
Currently rustdoc will fail if passed `-o foo/doc` if the `foo`
directory doesn't exist.
Also remove unneeded `mkdir` as `create_dir_all` can now handle
concurrent invocations.
2017-06-09 23:03:08 +01:00
Michael Killough
2da350168d
Document direct implementations on type aliases.
...
This improves #32077 , but is not a complete fix. For a type alias `type
NewType = AliasedType`, it will include any `impl NewType` and `impl
Trait for NewType` blocks in the documentation for `NewType`.
A complete fix would include the implementations from the aliased type
in the type alias' documentation, so that users have a complete
picture of methods that are available on the alias. However, to do this
properly would require a fix for #14072 , as the alias may affect the
type parameters of the type alias, making the documentation difficult to
understand. (That is, for `type Result = std::result::Result<(), ()>` we
would ideally show documentation for `impl Result<(), ()>`, rather than
generic documentation for `impl<T, E> Result<T, E>`).
I think this improvement is worthwhile, as it exposes implementations
which are not currently documented by rustdoc. The documentation for the
implementations on the aliased type are still accessible by clicking
through to the docs for that type. (Although perhaps it's now less
obvious to the user that they should click-through to get there).
2017-06-09 10:57:08 +09:00
Oliver Middleton
88c791bf69
rustdoc: Hide self: Box<Self> in list of deref methods
...
These methods can never be called through deref so there is no point
including them. For example you can't call `into_boxed_bytes` or
`into_string` on `String`.
2017-06-02 22:37:11 +01:00
Oliver Middleton
86ea93e83c
rustdoc: Cleanup associated const value rendering
...
Rather than (ab)using Debug for outputting the type in plain text use the
alternate format parameter which already does exactly that. This fixes
type parameters for example which would output raw HTML.
Also cleans up adding parens around references to trait objects.
2017-05-31 20:05:28 +01:00
Guillaume Gomez
6f4c12e210
Remove jquery dependency
2017-05-02 13:54:42 +02:00
Guillaume Gomez
80a2a94d5a
Re-enable hoedown by default
2017-04-22 13:25:14 +02:00
Corey Farwell
4ae25a60ba
Rollup merge of #41280 - QuietMisdreavus:rustdoc-toc, r=GuillaumeGomez
...
rustdoc: add a list of headings to the sidebar
It's another misdreavus rustdoc PR, which means it's time for Bikeshed City once again! `:3`
In an effort to aid navigation in long documentation pages, this PR adds a listing of headings to the sidebars of pages where such headings exist. For example, for structs, links to their fields, inherent methods, and trait implementations are available where applicable.
Examples:
* Modules/Crate roots

* Enums

* Primitives

* Traits

* Structs

Open questions:
* Right now, these kinds of pages (and also unions) are the only pages that will receive the name header - pages for functions, constants, macros, etc, won't have the corresponding name in their sidebar. Should I print the name regardless and only add table-of-contents links for pages that have them? This would make them match, for example, a struct with no public fields, no methods, and no trait implementations. The latter would still have a "Struct MyStruct" line above the module contents, with no header links to speak of, whereas a function wouldn't even have "Function my\_function".
* This is only a header listing, but there has been requests to include a more-complete listing of fields/methods/traits/etc, for example in #41123 .
2017-04-17 13:26:20 -04:00
QuietMisdreavus
27bfbd56f0
rustdoc: add a list of headings to the sidebar
2017-04-17 10:41:13 -05:00
QuietMisdreavus
8dd4c44ef6
merge with master to pick up pulldown switch
2017-04-09 10:38:38 -05:00
QuietMisdreavus
ae0e45c028
rustdoc: where clause adjustment to fix tests
...
- add spaces to output so stripping lines and breaking spaces renders
the same
- add commas to where clauses in rustdoc tests to match the new output
2017-04-06 14:19:45 -05:00
Oliver Middleton
f9fb381b2a
rustdoc: Use pulldown-cmark for Markdown HTML rendering
...
Instead of rendering all of the HTML in rustdoc this relies on
pulldown-cmark's `push_html` to do most of the work. A few iterator
adapters are used to make rustdoc specific modifications to the output.
This also fixes MarkdownHtml and link titles in plain_summary_line.
2017-04-06 13:09:20 +01:00
QuietMisdreavus
5bffa0aa50
rustdoc: don't add a space before { on traits with where clauses
...
cc #41025
2017-04-04 11:16:16 -05:00
QuietMisdreavus
6bc3d65948
rustdoc: properly indent fn signatures in traits
2017-04-04 10:31:57 -05:00
QuietMisdreavus
80bff6b596
rustdoc: format where clauses like rust-lang-nursery/fmt-rfcs#38
2017-03-31 18:04:42 -05:00
bors
abf5592510
Auto merge of #40338 - GuillaumeGomez:pulldown-switch, r=frewsxcv,steveklabnik
...
Replace hoedown with pull in rustdoc
cc @rust-lang/docs
2017-03-29 07:06:13 +00:00
Guillaume Gomez
d5b6c046de
Add missing markdown tags
2017-03-28 11:38:55 -06:00
Guillaume Gomez
b96fef8411
End of pulldown switch and remove completely hoedown
2017-03-28 11:38:55 -06:00
Oliver Schneider
eb447f4ef4
Fix various useless derefs and slicings
2017-03-27 08:58:00 +02:00
Corey Farwell
667e3166d8
Rollup merge of #40567 - clarcharr:rustdoc-sort, r=frewsxcv
...
Fix for #39596 : sort Trait2 before Trait10.
This is a change discussed in #39596 . Essentially, item names will be sorted as if they're (&str, u64) pairs instead of just `&str`, meaning that `"Apple" < "Banana"` and also `"Fruit10" > "Fruit2"`.
Sample sorting:
1. Apple
2. Banana
3. Fruit
4. Fruit0
5. Fruit00
6. Fruit1
7. Fruit01
8. Fruit2
9. Fruit02
10. Fruit20
11. Fruit100
12. Pear
Examples of generated documentation:
https://docs.charr.xyz/before-doc/test_sorting/
https://docs.charr.xyz/after-doc/test_sorting/
Screenshots of generated documentation:
Before: http://imgur.com/Ktb10ti
After: http://imgur.com/CZJjqIN
2017-03-24 18:13:09 -05:00
Clar Charr
c09083c3d1
Fix for #39596 : sort Trait1 before Trait2.
2017-03-23 18:21:34 -04:00
Guillaume Gomez
f53172287a
Add whitespace around "=" in assoc items
2017-03-21 16:22:15 -04:00
Corey Farwell
a04c7de2cf
Rollup merge of #40564 - GuillaumeGomez:rustdoc-const, r=frewsxcv
...
Fix const not displayed in rustdoc
Fixes #40331 .
r? @rust-lang/docs
2017-03-19 10:18:15 -04:00
bors
9c15de4fd5
Auto merge of #40346 - jseyfried:path_and_tokenstream_attr, r=nrc
...
`TokenStream`-based attributes, paths in attribute and derive macro invocations
This PR
- refactors `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.
- supports macro invocation paths for attribute procedural macros.
- e.g. `#[::foo::attr_macro] struct S;`, `#[cfg_attr(all(), foo::attr_macro)] struct S;`
- supports macro invocation paths for derive procedural macros.
- e.g. `#[derive(foo::Bar, super::Baz)] struct S;`
- supports arbitrary tokens as arguments to attribute procedural macros.
- e.g. `#[foo::attr_macro arbitrary + tokens] struct S;`
- supports using arbitrary tokens in "inert attributes" with derive procedural macros.
- e.g. `#[derive(Foo)] struct S(#[inert arbitrary + tokens] i32);`
where `#[proc_macro_derive(Foo, attributes(inert))]`
r? @nrc
2017-03-19 10:56:08 +00:00
Guillaume Gomez
9b892745ad
Fix const not displayed in rustdoc
2017-03-16 02:15:10 +01:00
Jeffrey Seyfried
68c1cc68b4
Refactor Attribute to use Path and TokenStream instead of MetaItem.
2017-03-14 04:03:43 +00:00
Oliver Middleton
19e0505dc7
rustdoc: Fix string escaping in implementors js files
...
The generates HTML can contain quotes so we need to make sure they are
escaped before inserting into the js files.
2017-03-12 05:12:27 +00:00
Corey Farwell
fda3f98746
Rollup merge of #39944 - GuillaumeGomez:associated-consts, r=frewsxcv
...
Improve associated constant rendering in rustdoc
Before:
<img width="1440" alt="screen shot 2017-02-19 at 00 30 51" src="https://cloud.githubusercontent.com/assets/3050060/23097697/caeed80e-f63a-11e6-98c2-5d27e4efd76d.png ">
After:
<img width="1440" alt="screen shot 2017-02-19 at 00 30 39" src="https://cloud.githubusercontent.com/assets/3050060/23097698/cfb4874e-f63a-11e6-80cf-ffbf5c5c6162.png ">
cc @SergioBenitez
r? @rust-lang/docs
2017-02-28 22:55:28 -05:00
Guillaume Gomez
d06f72d062
Apply the same transformation to every types
2017-02-28 00:27:19 +01:00
Guillaume Gomez
5ac7a035af
Put the const type and value into <code>
2017-02-26 18:55:07 +01:00
Guillaume Gomez
081336e8eb
Improve associated constant rendering in rustdoc
2017-02-26 15:50:53 +01:00
Guillaume Gomez
8c8eda8ecd
Fix nightly-only experimental API display
2017-02-25 17:48:09 +01:00
Guillaume Gomez
74204a0ce7
Rollup merge of #39740 - jimmycuadra:rustdoc-empty-stability, r=aturon
...
rustdoc: Only include a stability span if needed.
This patch gets rid of the empty stability boxes in docs by only including the span that creates it when the item actually has a stability class.
Here are images of the issue on `std::process::Output`:
Before:
<img width="340" alt="before" src="https://cloud.githubusercontent.com/assets/122457/22853638/ff88d1b2-f010-11e6-90d6-bf3d10e2fffa.png ">
After:
<img width="333" alt="after" src="https://cloud.githubusercontent.com/assets/122457/22853639/06bfe7cc-f011-11e6-9892-f0ea2cc6ec90.png ">
This is my first non-trivial patch to Rust, so I'm sure some of my approach is not idiomatic. Let me know how you'd like me to adjust!
2017-02-12 19:16:31 +01:00
Guillaume Gomez
0095ec25cc
Rollup merge of #39697 - notriddle:rustdoc_tooltip, r=GuillaumeGomez
...
Add the item type to the tooltip
See:
https://users.rust-lang.org/t/seeking-opinions-from-colorblind-rustaceans-coloring-in-rustdoc-code-blocks
2017-02-12 19:16:30 +01:00
Guillaume Gomez
be0e7498f0
Rollup merge of #39654 - ollie27:rustdoc_attributes, r=GuillaumeGomez
...
rustdoc: Show attributes on all item types
Currently attributes are only shown for structs, unions and enums but
they should be shown for all items. For example it is useful to know if a
function is `#[no_mangle]`.
2017-02-12 19:16:28 +01:00
Jimmy Cuadra
bd14c7f333
Remove extra closing span element.
2017-02-11 07:10:03 -08:00
Jimmy Cuadra
c603839d5f
rustdoc: Only include a stability span if needed.
2017-02-11 04:16:13 -08:00
Michael Howell
fce944d4e7
Add the item type to the tooltip
...
See:
https://users.rust-lang.org/t/seeking-opinions-from-colorblind-rustaceans-coloring-in-rustdoc-code-blocks
2017-02-09 10:38:29 -07:00
Oliver Middleton
147d173d02
rustdoc: Show attributes on all item types
...
Currently attributes are only shown for structs, unions and enums but
they should be shown for all items. For example it is useful to know if a
function is `#[no_mangle]`.
2017-02-08 21:15:20 +00:00
Oliver Middleton
05eef36fa5
rustdoc: Improve impl disambiguation
...
* Don't disambiguate if there are multiple impls for the same type.
* Disambiguate for impls of &Foo and &mut Foo.
* Don't try to disambiguate generic types.
2017-02-06 18:11:01 +00:00
Trevor Spiteri
fe324cea64
rustdoc: mark ffi functions with unsafety icon
2017-01-31 00:57:52 +01:00
Guillaume Gomez
b7678808af
Fix missing blank space issue
2017-01-15 18:38:00 +01:00
Manish Goregaokar
0a1c9ae022
Improved rustdoc rendering for unstable features
2017-01-09 21:50:00 -08:00
bors
9749df52b7
Auto merge of #38244 - estebank:escape-reason-docs, r=ollie27
...
rustdoc: escape the deprecated and unstable reason text
Fix #38220 .
Instead of the [current output](https://doc.rust-lang.org/std/boxed/trait.FnBox.html ):
<img width="967" alt="incorrect unescaped unstable reason in docs" src="https://cloud.githubusercontent.com/assets/1606434/21021898/73121d42-bd2f-11e6-8076-8a5127dbc010.png ">
display:
<img width="979" alt="escaped unstable reason in docs" src="https://cloud.githubusercontent.com/assets/1606434/21021876/52eb0f88-bd2f-11e6-9088-58bdc7d92328.png ">
2017-01-09 19:38:50 +00:00
bors
05f4a75eba
Auto merge of #38414 - estebank:doc-dissambiguate, r=steveklabnik
...
Rustdoc: disambiguate Implementors when the type name is not unique
Presentation [goes from](https://doc.rust-lang.org/stable/std/iter/trait.ExactSizeIterator.html#implementors ):
<img width="492" alt="" src="https://cloud.githubusercontent.com/assets/1606434/21276752/b2b50474-c387-11e6-96e1-9766851da269.png ">
to:
<img width="787" alt="" src="https://cloud.githubusercontent.com/assets/1606434/21276763/bb37f6b0-c387-11e6-8596-9163cb254674.png ">
on cases where there're multiple implementors with the same name.
Fixes #37762 .
2017-01-04 17:11:02 +00:00
Oliver Middleton
b9038c8e9f
rustdoc: Fix broken CSS for trait items
2016-12-29 02:23:49 +00:00
Esteban Küber
e766c465d2
Merge branch 'master' into escape-reason-docs
2016-12-27 17:02:52 -08:00
bors
314c28b729
Auto merge of #38329 - ollie27:rustdoc_stab_em_div, r=steveklabnik
...
rustdoc: Fix invalid HTML in stability notices
`em` tags cannot contain `p` tags so use `div`s instead of `em`s as the Markdown will create `p` tags.
2016-12-27 21:10:31 +00:00
Esteban Küber
346a442110
use same param name across methods
2016-12-22 23:20:22 -08:00
bors
a173778d1d
Auto merge of #38330 - ollie27:rustdoc_short_summaries, r=steveklabnik
...
rustdoc: Fix short summaries in search results
They should be run through a Markdown renderer in rustdoc to remove
links.
This also fixes the mouse over text for the Crates list on the sidebar.
[before](https://doc.rust-lang.org/nightly/std/index.html?search=ord ) [after](https://ollie27.github.io/rust_doc_test/std/index.html?search=ord )
2016-12-22 22:28:41 +00:00