about summary refs log tree commit diff
path: root/src/librustdoc/html/escape.rs
AgeCommit message (Collapse)AuthorLines
2025-02-19librustdoc: Use `pulldown-cmark-escape` for HTML escapingYotam Ofek-48/+3
2024-12-25Improve rustdoc codeGuillaume Gomez-4/+3
2024-11-28Fix new clippy lintsGuillaume Gomez-3/+3
2024-10-07Add comment to describe camelcase line breakMichael Howell-0/+10
2024-10-07rustdoc: improve `<wbr>`-insertion for SCREAMING_CAMEL_CASEMichael Howell-1/+1
2024-07-29rustdoc: move the wbr after the underscore, instead of beforeMichael Howell-4/+4
2024-07-29rustdoc: properly handle path wrappingMichael Howell-0/+5
2024-07-29rustdoc: avoid redundant HTML when there's already line breaksMichael Howell-0/+6
2024-07-29rustdoc: word wrap CamelCase in the item list tableMichael Howell-0/+44
This is an alternative to ee6459d6521cf6a4c2e08b6e13ce3c6ce5d55ed0. That is, it fixes the issue that affects the very long type names in https://docs.rs/async-stripe/0.31.0/stripe/index.html#structs. This is, necessarily, a pile of nasty heuristics. We need to balance a few issues: - Sometimes, there's no real word break. For example, `BTreeMap` should be `BTree<wbr>Map`, not `B<wbr>Tree<wbr>Map`. - Sometimes, there's a legit word break, but the name is tiny and the HTML overhead isn't worth it. For example, if we're typesetting `TyCtx`, writing `Ty<wbr>Ctx` would have an HTML overhead of 50%. Line breaking inside it makes no sense.
2023-12-01rustdoc: do not escape quotes in body textMichael Howell-0/+36
Escaping quote marks is only needed in attributes, not text. ```console $ du -hs doc-old/ doc-new/ 670M doc-old/ 669M doc-new/ ```
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-1/+1
2021-01-30rustdoc tweakingbors-17/+14
* Reuse memory * simplify `next_def_id`, avoid multiple hashing and unnecessary lookups * remove `all_fake_def_ids`, use the global map instead (probably not a good step toward parallelization, though...) * convert `add_deref_target` to iterative implementation * use `ArrayVec` where we know the max number of elements * minor touchups here and there * avoid building temporary vectors that get appended to other vectors At most places I may or may not be doing the compiler's job is this PR.
2020-11-15Make all rustdoc functions and structs crate-privateJoshua Nelson-1/+1
This gives warnings about dead code.
2019-12-22Format the worldMark Rousskov-2/+2
2019-02-23Transition librustdoc to 2018 editionHirokazu Hata-1/+1
2019-02-10rustc: doc commentsAlexander Regueiro-2/+2
2018-12-25Remove licensesMark Rousskov-10/+0
2016-03-22try! -> ?Jorge Aparicio-3/+3
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2015-02-05cleanup: replace `as[_mut]_slice()` calls with deref coercionsJorge Aparicio-1/+1
2015-01-21rollup merge of #21258: aturon/stab-3-indexAlex Crichton-2/+2
Conflicts: src/libcore/ops.rs src/librustc_typeck/astconv.rs src/libstd/io/mem.rs src/libsyntax/parse/lexer/mod.rs
2015-01-21Fallout from stabilization.Aaron Turon-2/+2
2015-01-20std: Rename Show/String to Debug/DisplayAlex Crichton-1/+1
This commit is an implementation of [RFC 565][rfc] which is a stabilization of the `std::fmt` module and the implementations of various formatting traits. Specifically, the following changes were performed: [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0565-show-string-guidelines.md * The `Show` trait is now deprecated, it was renamed to `Debug` * The `String` trait is now deprecated, it was renamed to `Display` * Many `Debug` and `Display` implementations were audited in accordance with the RFC and audited implementations now have the `#[stable]` attribute * Integers and floats no longer print a suffix * Smart pointers no longer print details that they are a smart pointer * Paths with `Debug` are now quoted and escape characters * The `unwrap` methods on `Result` now require `Display` instead of `Debug` * The `Error` trait no longer has a `detail` method and now requires that `Display` must be implemented. With the loss of `String`, this has moved into libcore. * `impl<E: Error> FromError<E> for Box<Error>` now exists * `derive(Show)` has been renamed to `derive(Debug)`. This is not currently warned about due to warnings being emitted on stage1+ While backwards compatibility is attempted to be maintained with a blanket implementation of `Display` for the old `String` trait (and the same for `Show`/`Debug`) this is still a breaking change due to primitives no longer implementing `String` as well as modifications such as `unwrap` and the `Error` trait. Most code is fairly straightforward to update with a rename or tweaks of method calls. [breaking-change] Closes #21436
2015-01-07Register new snapshotsAlex Crichton-8/+0
2015-01-06core: split into fmt::Show and fmt::StringSean McArthur-0/+8
fmt::Show is for debugging, and can and should be implemented for all public types. This trait is used with `{:?}` syntax. There still exists #[derive(Show)]. fmt::String is for types that faithfully be represented as a String. Because of this, there is no way to derive fmt::String, all implementations must be purposeful. It is used by the default format syntax, `{}`. This will break most instances of `{}`, since that now requires the type to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the correct fix. Types that were being printed specifically for users should receive a fmt::String implementation to fix this. Part of #20013 [breaking-change]
2015-01-01std: Enforce Unicode in fmt::WriterAlex Crichton-3/+3
This commit is an implementation of [RFC 526][rfc] which is a change to alter the definition of the old `fmt::FormatWriter`. The new trait, renamed to `Writer`, now only exposes one method `write_str` in order to guarantee that all implementations of the formatting traits can only produce valid Unicode. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md One of the primary improvements of this patch is the performance of the `.to_string()` method by avoiding an almost-always redundant UTF-8 check. This is a breaking change due to the renaming of the trait as well as the loss of the `write` method, but migration paths should be relatively easy: * All usage of `write` should move to `write_str`. If truly binary data was being written in an implementation of `Show`, then it will need to use a different trait or an altogether different code path. * All usage of `write!` should continue to work as-is with no modifications. * All usage of `Show` where implementations just delegate to another should continue to work as-is. [breaking-change] Closes #20352
2014-05-15Updates with core::fmt changesAlex Crichton-3/+3
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
2014-03-31Switch some tuple structs to pub fieldsAlex Crichton-1/+1
This commit deals with the fallout of the previous change by making tuples structs have public fields where necessary (now that the fields are private by default).
2014-02-20Mass rename if_ok! to try!Alex Crichton-3/+3
This "bubble up an error" macro was originally named if_ok! in order to get it landed, but after the fact it was discovered that this name is not exactly desirable. The name `if_ok!` isn't immediately clear that is has much to do with error handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In general, the agreed opinion about `if_ok!` is that is came in as subpar. The name `try!` is more invocative of error handling, it's shorter by 2 letters, and it looks fitting in almost all circumstances. One concern about the word `try!` is that it's too invocative of exceptions, but the belief is that this will be overcome with documentation and examples. Close #12037
2014-02-08std::fmt: convert the formatting traits to a proper self.Huon Wilson-2/+2
Poly and String have polymorphic `impl`s and so require different method names.
2014-02-03rustdoc: Remove io_error usageAlex Crichton-4/+5
2014-02-02std: rename fmt::Default to `Show`.Huon Wilson-1/+1
This is a better name with which to have a #[deriving] mode. Decision in: https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-01-28
2014-01-04Don't allow newtype structs to be dereferenced. #6246Brian Anderson-0/+1
2013-12-11Make 'self lifetime illegal.Erik Price-3/+3
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-11-26Removed unneccessary `_iter` suffixes from various APIsMarvin Löbel-1/+1
2013-10-03rustdoc: Document what's going on throughoutAlex Crichton-0/+7
This addresses some of @huonw's in #9691 about the startling lack of documentation guiding one throughout the innards of rustdoc::html
2013-09-27rustdoc: Include source files with documentationAlex Crichton-0/+44
All items have source links back to their actual code. Source files can be omitted with the doc(html_no_source) attribute on the crate. Currently there is no syntax highlighting, but that will come with syntax highlighting with all other snippets. Closes #2072