summary refs log tree commit diff
path: root/src/librustdoc/html/render.rs
AgeCommit message (Collapse)AuthorLines
2017-07-09Add spacing between trait functionsGuillaume Gomez-2/+9
2017-06-23rustdoc: Fix a few issues with associated constsOliver Middleton-40/+26
* Make sure private consts are stripped. * Don't show a code block for the value if there is none. * Make sure default values are shown in impls. * Make sure docs from the trait are used if the impl has no docs.
2017-06-12Rollup merge of #42592 - ollie27:rustdoc_empty_modules, r=steveklabnikCorey Farwell-15/+4
rustdoc: Stop stripping empty modules There is no good reason to strip empty modules with no documentation and doing so causes subtle problems. Fixes #42590
2017-06-11rustdoc: Stop stripping empty modulesOliver Middleton-15/+4
There is no good reason to strip empty modules with no documentation and doing so causes subtle problems.
2017-06-09rustdoc: Use `create_dir_all` to create output directoryOliver Middleton-20/+5
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-09Document direct implementations on type aliases.Michael Killough-2/+20
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-02rustdoc: Hide `self: Box<Self>` in list of deref methodsOliver Middleton-7/+12
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-05-31rustdoc: Cleanup associated const value renderingOliver Middleton-2/+2
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-02Remove jquery dependencyGuillaume Gomez-2/+0
2017-04-22Re-enable hoedown by defaultGuillaume Gomez-15/+29
2017-04-17Rollup merge of #41280 - QuietMisdreavus:rustdoc-toc, r=GuillaumeGomezCorey Farwell-3/+221
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 ![image](https://cloud.githubusercontent.com/assets/5217170/25019930/1000fa3a-2052-11e7-98ff-ddf5af18b3e6.png) * Enums ![image](https://cloud.githubusercontent.com/assets/5217170/25019954/33497f9e-2052-11e7-88cf-df46f1b3b8a3.png) * Primitives ![image](https://cloud.githubusercontent.com/assets/5217170/25019978/4820bbc6-2052-11e7-8b5a-96a864eb2a5b.png) * Traits ![image](https://cloud.githubusercontent.com/assets/5217170/25020093/bd1bc9f2-2052-11e7-9cd1-00a0ad8007bc.png) * Structs ![image](https://cloud.githubusercontent.com/assets/5217170/25020145/d75206b0-2052-11e7-88cc-9e9525084775.png) 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-17rustdoc: add a list of headings to the sidebarQuietMisdreavus-3/+221
2017-04-09merge with master to pick up pulldown switchQuietMisdreavus-12/+63
2017-04-06rustdoc: where clause adjustment to fix testsQuietMisdreavus-2/+2
- 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-06rustdoc: Use pulldown-cmark for Markdown HTML renderingOliver Middleton-7/+5
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-04rustdoc: don't add a space before `{` on traits with where clausesQuietMisdreavus-3/+8
cc #41025
2017-04-04rustdoc: properly indent fn signatures in traitsQuietMisdreavus-23/+27
2017-03-31rustdoc: format where clauses like rust-lang-nursery/fmt-rfcs#38QuietMisdreavus-37/+25
2017-03-29Auto merge of #40338 - GuillaumeGomez:pulldown-switch, r=frewsxcv,steveklabnikbors-5/+8
Replace hoedown with pull in rustdoc cc @rust-lang/docs
2017-03-28Add missing markdown tagsGuillaume Gomez-5/+8
2017-03-28End of pulldown switch and remove completely hoedownGuillaume Gomez-4/+4
2017-03-27Fix various useless derefs and slicingsOliver Schneider-2/+2
2017-03-24Rollup merge of #40567 - clarcharr:rustdoc-sort, r=frewsxcvCorey Farwell-1/+49
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-23Fix for #39596: sort Trait1 before Trait2.Clar Charr-1/+49
2017-03-21Add whitespace around "=" in assoc itemsGuillaume Gomez-1/+1
2017-03-19Rollup merge of #40564 - GuillaumeGomez:rustdoc-const, r=frewsxcvCorey Farwell-3/+5
Fix const not displayed in rustdoc Fixes #40331. r? @rust-lang/docs
2017-03-19Auto merge of #40346 - jseyfried:path_and_tokenstream_attr, r=nrcbors-2/+2
`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-16Fix const not displayed in rustdocGuillaume Gomez-3/+5
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-2/+2
2017-03-12rustdoc: Fix string escaping in implementors js filesOliver Middleton-1/+1
The generates HTML can contain quotes so we need to make sure they are escaped before inserting into the js files.
2017-02-28Rollup merge of #39944 - GuillaumeGomez:associated-consts, r=frewsxcvCorey Farwell-21/+43
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-28Apply the same transformation to every typesGuillaume Gomez-15/+28
2017-02-26Put the const type and value into <code>Guillaume Gomez-8/+17
2017-02-26Improve associated constant rendering in rustdocGuillaume Gomez-1/+1
2017-02-25Fix nightly-only experimental API displayGuillaume Gomez-4/+4
2017-02-12Rollup merge of #39740 - jimmycuadra:rustdoc-empty-stability, r=aturonGuillaume Gomez-5/+11
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-12Rollup merge of #39697 - notriddle:rustdoc_tooltip, r=GuillaumeGomezGuillaume Gomez-1/+2
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-12Rollup merge of #39654 - ollie27:rustdoc_attributes, r=GuillaumeGomezGuillaume Gomez-5/+15
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-11Remove extra closing span element.Jimmy Cuadra-1/+0
2017-02-11rustdoc: Only include a stability span if needed.Jimmy Cuadra-5/+12
2017-02-09Add the item type to the tooltipMichael Howell-1/+2
See: https://users.rust-lang.org/t/seeking-opinions-from-colorblind-rustaceans-coloring-in-rustdoc-code-blocks
2017-02-08rustdoc: Show attributes on all item typesOliver Middleton-5/+15
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-06rustdoc: Improve impl disambiguationOliver Middleton-9/+23
* 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-01-31rustdoc: mark ffi functions with unsafety iconTrevor Spiteri-5/+6
2017-01-15Fix missing blank space issueGuillaume Gomez-2/+4
2017-01-09Improved rustdoc rendering for unstable featuresManish Goregaokar-11/+18
2017-01-09Auto merge of #38244 - estebank:escape-reason-docs, r=ollie27bors-4/+4
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-04Auto merge of #38414 - estebank:doc-dissambiguate, r=steveklabnikbors-2/+18
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.
2016-12-29rustdoc: Fix broken CSS for trait itemsOliver Middleton-2/+1
2016-12-27Merge branch 'master' into escape-reason-docsEsteban Küber-8/+20