Commit graph

836 commits

Author SHA1 Message Date
ZJPzjp
e2c8f40962
add more links of books, especially in Chinese version (#175)
* add more links of books, especially in Chinese version

* Add `:book/zh` command

* mv Chinese version links in book to book/zh

Co-authored-by: Folyd <lyshuhow@gmail.com>
2022-07-07 21:24:51 +08:00
Folyd
04c7922e8e Add :book/zh command 2022-07-07 20:30:36 +08:00
Folyd
c49dd53644 Set default offlineDocPath to empty 2022-07-05 13:13:03 +08:00
Folyd
da193e6425 Support the new search-index loading, see https://github.com/rust-lang/rust/pull/98124 2022-07-04 15:31:53 +08:00
Folyd
2301f9aebd Replace hasOwnProperty check with in operator 2022-07-02 17:14:30 +08:00
Folyd
e21ceb2ff2 Replace 'crate:check' action with chrome.storage API query 2022-07-02 17:05:39 +08:00
Folyd
f5f2b6b1f8 Update testimonials 2022-06-12 21:55:15 +08:00
Folyd
8c6c174157 Update README, format code 2022-06-06 10:50:52 +08:00
Folyd
2725c443fb Update changelog 2022-06-06 00:26:19 +08:00
Folyd
3aa42c012e Do not use async callback for onMessage
Fix error: "The message port closed before a response was received."
2022-06-06 00:14:02 +08:00
Folyd
5ba09440f0 Release v1.7.0 2022-06-05 23:49:36 +08:00
Folyd
df11a25f46 Move const into scope 2022-06-05 23:29:35 +08:00
Folyd
cc43ed86d8 Register :blog command 2022-06-01 22:29:02 +08:00
Folyd
fb0516de00 Support update blog command posts index 2022-06-01 22:22:55 +08:00
Folyd
626668106b
Fix search base iterate issue (#159) 2022-05-31 22:48:08 +08:00
Folyd
fe816951cc Fix rustdocVars nullable checking 2022-05-31 21:57:41 +08:00
Folyd
8ef9e2ff1c Update core submodule 2022-05-30 10:58:32 +08:00
Folyd
28f5727124 Migrate to ES6 2022-05-29 19:44:36 +08:00
Folyd
c1beb499ce Feat some codes 2022-05-29 19:23:25 +08:00
Folyd
a493c9c5a7 Fix std docs search index update 2022-05-29 18:58:24 +08:00
Folyd
f0e60fe6df Fix storage change keys 2022-05-29 18:37:54 +08:00
Folyd
7646f7b23f
Fix crate manager async/await function calling (#158) 2022-05-29 18:33:28 +08:00
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