Commit graph

914 commits

Author SHA1 Message Date
Folyd
70ce097adb
Fix legacy rootPath getter doesn't allow async issue (#157) 2022-05-29 11:15:05 +08:00
Folyd
c2f92b7f94
Migrate localStorage to chrome storage API (#155)
* Add migrations.js

* Migrate crate manager to storage

* Add common js files to base template

* Migrate statistics, crates, index pages

* Don't re-migrate.

* Fix statistics and history storage

* Migrate all settings item to async getter and setter

* Migrate main.js to chrome.storage api

* Migrate settings, import/export pages to chrome.storage api

* Fix main.js

* Add comments to setttings.js
2022-05-29 10:58:42 +08:00
Folyd
244ef2f669 Fix eslint 2022-05-22 11:55:01 +08:00
Folyd
3bfc0bfe63 Don't reposition feature flag menu. Fixes #154 2022-05-21 19:11:59 +08:00
Folyd
0db05fe5ea Add margin top to add to extension button 2022-05-13 11:42:04 +08:00
shwin
94f2552ddb
Setup eslint (#153) 2022-05-12 22:17:08 +08:00
Folyd
1690be646c
Create codeql-analysis.yml 2022-04-20 23:20:48 +08:00
Folyd
f2ab2b03cb Only render .top-doc headings as TOC. Fixes #152 2022-04-20 23:12:35 +08:00
Folyd
b211b7d233 Fix docs.rs TOC max-width and padding 2022-04-20 22:35:46 +08:00
Folyd
f781175da1 Release v1.6.0 2022-03-02 12:02:08 +08:00
Folyd
cec5a0dc61 Update to latest search index 2022-02-26 10:19:47 +08:00
Folyd
494de24559 Bump std search-index to v1.59.0 2022-02-25 18:08:36 +08:00
Folyd
7fe692246b Add new testimonial 2022-02-24 14:06:35 +08:00
Folyd
b386504ad5 Extract parseCrateVersionFromDOM function and change to proper css selector 2022-02-22 15:58:16 +08:00
Folyd
d841642cf4 Improve optional dependencies ui and parsing 2022-02-22 15:18:55 +08:00
Folyd
8b81fc70fb Render optional. dependencies in feature flags menu. 2022-02-21 21:08:04 +08:00
Folyd
00ad329c39 Improve compatibility for TOC of docs.rs 2022-02-21 17:05:53 +08:00
Folyd
dafa48adf5
Merge pull request #147 from rrbutani/master
Fix latest version parsing for crates with hyphens in their name
2022-02-15 00:09:17 +08:00
Rahul Butani
9f0c2b17d4
Fix latest version parsing for crates with hyphens
Crates with hyphens have their version extracted from the DOM (when
viewing the latest version of a crate and adding it to the extension's
index) incorrectly.

This in turn causes the extension to produce invalid docs.rs links.

----

[This snippet](4e84385e83 (diff-dc9969d9ec58ceb09765359c0caa6852a087b462d98bb9a7e45f1ac75c79b066L12-R14))
(which itself addressed[fallout](7483ba377d (diff-dc9969d9ec58ceb09765359c0caa6852a087b462d98bb9a7e45f1ac75c79b066R12-R15))
from `rustdoc` [changing its version output](6a5f8b1aef (diff-40a0eb025da61717b3b765ceb7fab21d91af3012360e90b9f46e15a4047946faL1768-L1776)))
is the problematic bit.

Updating the logic linked above to take the _last_ element after
splitting on `-` instead of the second fixes this case but I think this
leaves _other_ edge cases unhandled.

For example, `cargo` and friends allow for [pre-release versions which
are allowed to have hyphens](https://semver.org/#spec-item-9) (i.e.
`0.0.1-my-extremely-unstable-release`). While it's unlikely that the
docs.rs "latest" link for a crate will redirect to one of these, it is
still possible – `docsrs` will [search stable, unyanked releases _first_
but *will* fall back to pre-releases](dad5863093/src/web/mod.rs (L341-L368)).
The [`wasi` crate](https://docs.rs/wasi/latest/wasi/) is one such
example of this (no "stable" releases as of this writing, pre-release
version has a hypen in it: `0.11.0+wasi-snapshot-preview1`).

Reverting to the previous method (grabbing the version from the sidebar)
and changing the query to `'nav.sidebar .version'` is general enough to
support pages generated before and after the `rustdoc` version change
without being _too_ general (and potentially picking up things in
user-added HTML snippets). This is the change this commit implements.

The downside to this approach is that it doesn't work on `rustdoc`
output that predates the addition of the version in the sidebar; since
docs.rs [doesn't rebuild docs for older releases](https://github.com/rust-lang/docs.rs/issues/464)
this can be a real concern for older stable crates that haven't had a
release in a while.

---

Another approach is to snoop through some of the relative links on the
page and to extract the version from the relative URLs there. There
doesn't seem to be an obvious thing in the DOM to go after and we're
definitely still susceptible to changes in `rustdoc` this way; I'm not
sure if this is worth doing.

Yet another option is to pick an approach based on the `rustdoc` version
in [`rustdoc-vars`](502d6aa47b/src/librustdoc/html/templates/page.html (L147))
(i.e. `document.querySelector("#rustdoc-vars").getAttribute("data-rustdoc-version")`).
This could help a little but it's worth noting that it itself is a
relatively recent addition to the `rustdoc` HTML output, I think.
2022-02-14 07:50:20 -06:00
Folyd
dcacb8d6d7 Add two new FAQs 2022-02-14 17:03:05 +08:00
Folyd
599b1c9a31 Release v1.5.1 2022-02-01 20:51:50 +08:00
Folyd
b3b7fe900e Improve impl blocks highlight effects. Fixes #144 2022-01-31 17:29:34 +08:00
Folyd
2879e9a460 Improve changelog 2022-01-26 00:26:57 +08:00
Folyd
25cf022f09 Release version v1.5.0 2022-01-25 23:02:33 +08:00
Folyd
668ebac0a4 Update search index 2022-01-25 22:59:25 +08:00
Folyd
3047383453 Add a default rustdoc-toggle outline color 2022-01-25 22:47:00 +08:00
Folyd
2d7351ad64 Add original color to .rse-link 2022-01-25 21:24:56 +08:00
Folyd
fcc0d2911d Enable default search dynamically. Fixes #141 2022-01-24 00:07:56 +08:00
Folyd
0aeb273672 Support customize default search items in settings 2022-01-23 23:51:45 +08:00
Folyd
9924c7351c Enable external crate searching as the default searching 2022-01-17 20:44:10 +08:00
Folyd
1f0c705cdf Improve rustdoc toggle border styles 2022-01-15 23:26:17 +08:00
Folyd
f48e29b558 Fix docs.rs TOC render and UI 2022-01-15 19:13:12 +08:00
Folyd
4e84385e83 Fix crate version parse bug 2022-01-15 18:16:16 +08:00
Folyd
1e05684079 Improve rustdoc-toggle class 2022-01-15 18:03:30 +08:00
Folyd
cd1483cec7 Fix add to extension button toggle float issue 2022-01-15 17:37:13 +08:00
Naturel Lee
633cd0d1ab feat: rust docs enhancement 2022-01-12 20:21:59 +08:00
Folyd
b9b8819f50 Update version 2022-01-11 20:56:59 +08:00
Folyd
e16fcd96f0 Fix update label/rfc index bug 2022-01-06 23:06:51 +08:00
Folyd
1b09aa669b Bump to version 1.4.1 2021-12-27 23:35:53 +08:00
Folyd
5028b2e895 Update latest index 2021-12-27 23:33:13 +08:00
Folyd
64a19d49c2 Filter out auto-generated google api crates. Fixes #138 2021-12-17 16:59:09 +08:00
Folyd
5e95997ce6 Add unsafe code guide book 2021-12-15 17:31:40 +08:00
Folyd
8082415b67 export RUST_BACKTRACE=full 2021-12-09 11:52:57 +08:00
Folyd
6476091b74 Fix #134. get the searchIndexJs from window.searchIndexJs 2021-12-07 10:56:27 +08:00
Folyd
7483ba377d Fix #135, docs.rs latest version path compatibility 2021-12-07 10:23:24 +08:00
Folyd
543f813cab Bump to edition 2021 2021-11-29 22:15:03 +08:00
Folyd
dec5e4cbe6 Fix caniuse index parse issue 2021-11-29 22:13:50 +08:00
Folyd
5567835955 Kudos to nrc's rfc-index repository. 2021-11-01 23:16:33 +08:00
Folyd
a8ec0ef873 Release v1.4.0 2021-10-27 22:49:05 +08:00
Folyd
ee7c3fb6d7 Update index 2021-10-27 22:30:10 +08:00