summary refs log tree commit diff
path: root/src/librustdoc/html/highlight.rs
AgeCommit message (Collapse)AuthorLines
2019-05-11Keep the original token in `ast::Lit`Vadim Petrochenkov-0/+2
2019-02-23Transition librustdoc to 2018 editionHirokazu Hata-1/+1
2019-02-10rustc: doc commentsAlexander Regueiro-1/+1
2019-01-20Auto merge of #56884 - euclio:codeblock-diagnostics, r=QuietMisdreavusbors-37/+55
rustdoc: overhaul code block lexing errors Fixes #53919. This PR moves the reporting of code block lexing errors from rendering time to an early pass, so we can use the compiler's error reporting mechanisms. This dramatically improves the diagnostics in this situation: we now de-emphasize the lexing errors as a note under a warning that has a span and suggestion instead of just emitting errors at the top level. Additionally, this PR generalizes the markdown -> source span calculation function, which should allow other rustdoc warnings to use better spans in the future. Last, the PR makes sure that the code block is always emitted in the docs, even if it fails to highlight correctly. Of note: - The new pass unfortunately adds another pass over the docs to gather the doc blocks for syntax-checking. I wonder if this could be combined with the pass that looks for testable blocks? I'm not familiar with that code, so I don't know how feasible that is. - `pulldown_cmark` doesn't make it easy to find the spans of the code blocks, so the code that calculates the spans is a little nasty. It works for all the test cases I threw at it, but I wouldn't be surprised if an edge case would break it. Should have a thorough review. - This PR worsens the state of #56885, since those certain fatal lexing errors are now emitted before docs get generated at all.
2019-01-18Add token::ErrYuki Okushi-1/+1
2019-01-14rustdoc: check code block syntax in early passAndy Russell-37/+55
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-02Remove not used `DotEq` tokenyui-knk-1/+1
Currently libproc_macro does not use `DotEq` token. https://github.com/rust-lang/rust/pull/49545 changed libproc_macro to not generate `DotEq` token.
2018-10-26Rollup merge of #54921 - GuillaumeGomez:line-numbers, r=QuietMisdreavuskennytm-5/+8
Add line numbers option to rustdoc Fixes #22878. r? @QuietMisdreavus
2018-10-09Add line numbers option to rustdocGuillaume Gomez-5/+8
2018-09-29Add a sentence before rustc errorsGuillaume Gomez-1/+1
2018-09-29Improve error display for codeblocks in rustdocGuillaume Gomez-7/+18
2018-08-19fix tidy errorsDonato Sciarra-2/+4
2018-08-19mv codemap source_mapDonato Sciarra-5/+5
2018-08-19mv codemap() source_map()Donato Sciarra-2/+2
2018-08-19mv (mod) codemap source_mapDonato Sciarra-1/+1
2018-08-19mv filemap source_fileDonato Sciarra-1/+1
2018-08-19mv CodeMap SourceMapDonato Sciarra-3/+3
2018-08-07Avoid unnecessary pattern matching against Option and Resultljedrz-1/+1
2018-07-31Add dyn to WriteMark Rousskov-1/+1
2018-07-31Cleanup highlighting codeMark Rousskov-38/+22
Removes some unused code and de-publicizes structs
2018-07-30Delete unused code in rustdocMark Rousskov-14/+0
2018-07-25Add missing dynTatsuyuki Ishi-2/+2
2018-05-26Add `Ident::as_str` helperVadim Petrochenkov-1/+1
2018-05-20lexer: Fix span override for the first token in a stringVadim Petrochenkov-2/+2
2018-05-15Represent lifetimes as two joint tokens in proc macrosVadim Petrochenkov-1/+1
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-4/+4
2018-03-17syntax: Make `_` an identifierVadim Petrochenkov-1/+1
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-3/+3
2017-11-06tweak notes on ignore/compile_fail examplesQuietMisdreavus-1/+1
2017-09-22Add support for `..=` syntaxAlex Burka-3/+3
Add ..= to the parser Add ..= to libproc_macro Add ..= to ICH Highlight ..= in rustdoc Update impl Debug for RangeInclusive to ..= Replace `...` to `..=` in range docs Make the dotdoteq warning point to the ... Add warning for ... in expressions Updated more tests to the ..= syntax Updated even more tests to the ..= syntax Updated the inclusive_range entry in unstable book
2017-09-11Add arrow and improve displayGuillaume Gomez-9/+2
2017-09-11Add class for codeblocksGuillaume Gomez-2/+15
2017-08-29Rollup merge of #43918 - mystor:rustdoc-pound, r=QuietMisdreavusAriel Ben-Yehuda-15/+43
Don't highlight # which does not start an attribute in rustdoc Currently when we highlight some macros for rustdoc (e.g. `quote!` from https://github.com/dtolnay/quote), we get really bad syntax highlighting, because we assume that every token between a `#` character and the next `]` in the source must be an attribute. This patch improves that highlighting behavior to instead only highlight after finding the `[` token after the `#` token. (NOTE: I've only run this patch against https://github.com/nrc/rustdoc-highlight so if it doesn't build on travis that's why - I don't have a recent rustc build on this laptop) I'm guessing r? @steveklabnik
2017-08-17Rollup merge of #43891 - Fourchaux:master, r=steveklabnikCorey Farwell-1/+1
Fix typos & us spellings Fixing some typos and non en-US spellings. (Update of PR https://github.com/rust-lang/rust/pull/42812 )
2017-08-16Don't highlight # which does not start an attribute in rustdocMichael Layzell-15/+43
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-2/+2
Like #43008 (f668999), but _much more aggressive_.
2017-08-15Fix typos & us spellingsFourchaux-1/+1
2017-07-05Merge remote-tracking branch 'origin/master' into proc_macro_apiAlex Crichton-1/+1
2017-06-29Change some terminology around keywords and reserved identifierspetrochenkov-1/+1
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-1/+1
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-05-02Address reviewest31-1/+1
2017-05-02Removal pass for anonymous parametersest31-2/+6
Removes occurences of anonymous parameters from the rustc codebase, as they are to be deprecated. See issue #41686 and RFC 1685.
2017-04-26Implement a file-path remapping feature in support of debuginfo and ↵Michael Woerister-5/+5
reproducible builds.
2017-02-28Rollup merge of #39944 - GuillaumeGomez:associated-consts, r=frewsxcvCorey Farwell-3/+3
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-28Remove `Token::MatchNt`.Jeffrey Seyfried-1/+1
2017-02-28Apply the same transformation to every typesGuillaume Gomez-3/+3
2017-01-17Fix fallout in `rustdoc`.Jeffrey Seyfried-9/+7
2016-12-23Fix rustdoc highlighting of `&` and `*`.Chris Morgan-3/+5
Whitespace tokens were included, so the span check used with `&` was incorrect, and it was never highlighted as kw-2. The `*` in `*foo` and `*const T` should also be highlighted kw-2, so I added them. Note that this *will* cause mishighlighting of code like `1*2`, but that should have been written `1 * 2`. Same deal with `1&2`.
2016-10-19Improve `$crate`.Jeffrey Seyfried-3/+2