summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2021-10-04Auto merge of #89277 - jyn514:codeblock-edition, r=GuillaumeGomezbors-15/+8
Use the correct edition for syntax highlighting doctests Previously it would unconditionally use edition 2015, which was incorrect. Helps with https://github.com/rust-lang/rust/issues/89135 in that you can now override the doctest to be 2018 edition instead of being forced to fix the error. This doesn't resolve any of the deeper problems that rustdoc disagrees with most rust users on what a code block is. cc `@Mark-Simulacrum`
2021-09-14Workaround blink/chromium grid layout limitation of 1000 rowsStefan Schindler-0/+12
See https://github.com/rust-lang/rust/issues/88545 for more details (cherry picked from commit 0bf16af5f331079b1da91849ed0eb083b9b8e5f2)
2021-09-14fix ICE on hidden tuple variant fieldsEmil Gardström-24/+27
this also renders them as `_`, which rustdoc previously did not. (cherry picked from commit 4a915ac8d9f33567b77b23e90557f92860aa6db4)
2021-09-02Auto merge of #88516 - matthiaskrgr:clippy_perf_end_august, ↵bors-4/+3
r=jyn514,GuillaumeGomez some low hanging clippy::perf fixes
2021-09-01Auto merge of #88490 - GuillaumeGomez:associated-types-implementors-display, ↵bors-38/+81
r=camelid,Manishearth Display associated types of implementors Fixes #86631. Contrary to before, it doesn't display methods. I also had to "resurrect" the `auto-hide-trait-implementations` setting. :3 Only question at this point: should I move the `render_impl` boolean arguments into one struct? We're starting to have quite a lot of them... cc `@cynecx` r? `@camelid`
2021-09-01Remove implementors settingGuillaume Gomez-6/+0
2021-09-01Clean render_impl argumentsGuillaume Gomez-46/+67
2021-09-01Rollup merge of #88410 - camelid:fix-assoc-bold, r=GuillaumeGomezMara Bos-1/+1
Remove bolding on associated constants Associated types don't get bolded, so it looks off to have one kind bolded and one not.
2021-08-31some low hanging clippy::perf fixesMatthias Krüger-4/+3
2021-08-31Remove bolding on associated constantsNoah Lev-1/+1
Associated types don't get bolded, so it looks off to have one kind bolded and one not.
2021-08-31Rollup merge of #88391 - GuillaumeGomez:fix-json-enum-variant, ↵Mara Bos-17/+24
r=camelid,notriddle Fix json tuple struct enum variant Fixes #87887. cc `@dsherret` `@camelid` r? `@notriddle`
2021-08-30Put back "auto-collapse-implementors" settingGuillaume Gomez-0/+6
2021-08-30Put back display of associated items (types and consts)Guillaume Gomez-11/+33
2021-08-29Rollup merge of #88419 - GuillaumeGomez:code-blocks-colors, r=camelid,notriddleGuillaume Gomez-1/+1
Fix code blocks color in Ayu theme Fixes #88415. cc `@camelid` r? `@notriddle`
2021-08-29Rollup merge of #88173 - camelid:refactor-markdown-length-limit, ↵Guillaume Gomez-43/+270
r=GuillaumeGomez Refactor Markdown length-limited summary implementation This PR is a new approach to #79749. This PR refactors the implementation of `markdown_summary_with_limit()`, separating the logic of determining when the limit has been reached from the actual rendering process. The main advantage of the new approach is that it guarantees that all HTML tags are closed, whereas the previous implementation could generate tags that were never closed. It also ensures that no empty tags are generated (e.g., `<em></em>`). The new implementation consists of a general-purpose struct `HtmlWithLimit` that manages the length-limiting logic and a function `markdown_summary_with_limit()` that renders Markdown to HTML using the struct. r? `@GuillaumeGomez`
2021-08-29Use the correct type for Enum variant tuplesGuillaume Gomez-17/+24
2021-08-28Fix code blocks color in ayu themeGuillaume Gomez-1/+1
2021-08-27Introduce `~const`Deadbeef-1/+1
- [x] Removed `?const` and change uses of `?const` - [x] Added `~const` to the AST. It is gated behind const_trait_impl. - [x] Validate `~const` in ast_validation. - [ ] Add enum `BoundConstness` to the HIR. (With variants `NotConst` and `ConstIfConst` allowing future extensions) - [ ] Adjust trait selection and pre-existing code to use `BoundConstness`. - [ ] Optional steps (*for this PR, obviously*) - [ ] Fix #88155 - [ ] Do something with constness bounds in chalk
2021-08-26Auto merge of #88222 - jyn514:shared-cache, r=GuillaumeGomezbors-49/+38
rustdoc: Move Cache from Context to SharedContext r? `@camelid`
2021-08-25Don't panic if `close_tag()` is called without tags to closeNoah Lev-3/+14
This can happen when a tag is opened after the length limit is reached; the tag will not end up being added to `unclosed_tags` because the queue will never be flushed. So, now, if the `unclosed_tags` stack is empty, `close_tag()` does nothing. This change fixes a panic in the `limit_0` unit test.
2021-08-25Assert that `tag_name` is alphabeticNoah Lev-0/+8
2021-08-25Add tests for `HtmlWithLimit`Noah Lev-0/+122
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1
2021-08-22Move Cache from Context to SharedContextJoshua Nelson-49/+38
2021-08-21Use `write!`Noah Lev-6/+2
2021-08-21Use the length limit as the initial capacityNoah Lev-2/+11
The length limit turns out to be a surprisingly good heuristic for initial allocation size. See here for more details [1]. [1]: https://github.com/rust-lang/rust/pull/88173#discussion_r692531631
2021-08-21Clarify wording in docsNoah Lev-1/+1
2021-08-19Refactor Markdown length-limited summary implementationNoah Lev-43/+124
This commit refactors the implementation of `markdown_summary_with_limit()`, separating the logic of determining when the limit has been reached from the actual rendering process. The main advantage of the new approach is that it guarantees that all HTML tags are closed, whereas the previous implementation could generate tags that were never closed. It also ensures that no empty tags are generated (e.g., `<em></em>`). The new implementation consists of a general-purpose struct `HtmlWithLimit` that manages the length-limiting logic and a function `markdown_summary_with_limit()` that renders Markdown to HTML using the struct.
2021-08-19Rollup merge of #88093 - Kobzol:rustdoc-wrap-code-in-code-tag, r=GuillaumeGomezGuillaume Gomez-266/+294
[rustdoc] Wrap code blocks in <code> tag This PR modifies Rustdoc output so that fenced code snippets, items and whole file source codes are wrapped in `<pre><code>` instead of just `<pre>`. This should improve the semantic meaning of the generated content. I'm not sure what to do about `render_attributes_in_pre` and `render_attributes_in_code`. These functions were clearly expected to be used for things inside `<pre>` or `<code>`, and since I added `<code>` in this PR, some of them will be used in a different context than before. However, it seems to me that even before they were not consistent. For example, `item_constant` used `render_attributes_in_code` for its attributes, however there was no `<code>` used for constants before this PR... Should I create some `rustdoc-gui` tests? For example to check that all `<pre>` tags have a `<code>` child? Fixes: https://github.com/rust-lang/rust/issues/88020
2021-08-19[rustdoc] Wrap code blocks in <code> tagJakub Beránek-266/+294
2021-08-18Rollup merge of #88111 - GuillaumeGomez:background-color-jump-to-def, r=jhprattGuillaume Gomez-0/+9
Add background-color on clickable definitions in source code Someone suggested to add a decoration on clickable elements in the source code pages: ![Screenshot from 2021-08-17 14-49-39](https://user-images.githubusercontent.com/3050060/129728911-def74f9e-50e2-40d2-b512-e23f1b3d0409.png) ![Screenshot from 2021-08-17 14-49-47](https://user-images.githubusercontent.com/3050060/129728925-14aec500-82ff-4336-955a-4173c769deeb.png) ![Screenshot from 2021-08-17 14-49-52](https://user-images.githubusercontent.com/3050060/129728927-a8a89d7a-e837-4ff5-b094-35be23629d14.png) The idea is to not disturb the reading while telling the reader "you can click on this one", which is why it's not a text decoration. What do you think `@rust-lang/rustdoc` ? r? `@Nemo157`
2021-08-18Fix anchors display in rustdocGuillaume Gomez-5/+9
2021-08-17Add background-color on clickable definitions in source codeGuillaume Gomez-0/+9
2021-08-16Rollup merge of #87178 - moxian:rd-use, r=jyn514Mara Bos-4/+3
[rustdoc] Copy only item path to clipboard rather than full `use` statement. The (somewhat) recent addition of the "copy item import to clipboard" button is extremely nice. However, i tend to write my code with fully qualified paths wherever feasible and only resort to `use` statements as a refactoring pass. This makes the "copy to clipboard" workflow awkward to use, as i would be copy-pasting that as, say ```rust impl use std::ops::Add; for MyType { ``` and then go back and remove the `use ` and `;`. This PR removes the `use ;` decorations, making it much nicer to use for fully-qualified items. I argue, however, that this does not noticeably degrade experience for those who prefer to import items, since the hard part about those is getting the path right, and writing the `use ;` decoration can be done by hand with little effort.
2021-08-12Updates favicon order of precedence as it matters to Chromeskim-2/+2
2021-08-08Fix heading colours in Ayu themeKlim Tsoutsman-1/+1
Closes #87828 The issue seems to stem from #87210 where code headings were changed from a heading containing code to a heading with the `code-header` class. `rustdoc.css` was updated, but `ayu.css` was missed.
2021-08-05Remove LightSpan and use Span directlyGuillaume Gomez-98/+44
2021-08-05Remove warnings/errors from compiler when using typeck_body in rustdoc span ↵Guillaume Gomez-5/+5
map builder
2021-08-05* Rename LightSpan::empty into LightSpan::dummyGuillaume Gomez-23/+19
* Add Classifier::new_light_span to wrap LightSpan::new_in_file constructor
2021-08-05Add missing root_path when generating links using hrefGuillaume Gomez-2/+26
2021-08-05Add documentation and FIXMEGuillaume Gomez-4/+7
2021-08-05Fix invalid generation of HTML in highlightGuillaume Gomez-41/+60
2021-08-05formattingGuillaume Gomez-30/+19
2021-08-05Use rustdoc Span in LinkFromSrc directlyGuillaume Gomez-6/+5
2021-08-05Move extra arguments for highlight URL generation into a new ContextInfo ↵Guillaume Gomez-40/+42
struct for better readability
2021-08-05Wrap the span_map tuple index into a type called "LightSpan"Guillaume Gomez-44/+68
2021-08-05Improve code readabilityGuillaume Gomez-57/+46
2021-08-05* Rename Span::from_rustc_span to Span::newGuillaume Gomez-1/+1
* Rename Span::wrap to Span::wrap_raw * Improve documentation for Span::wrap_raw
2021-08-05* Rename 'move_span' into 'local_span_to_global_span'Guillaume Gomez-14/+78
* Add documentation on new arguments/functions
2021-08-05Underline source code links on hoverGuillaume Gomez-0/+4