Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
`cargo doc --open` should start a web server to enable keyboard accessibility #4966
Comments
|
This has historically been controversial. I'm pro, but there are a lot of people against. |
|
What are the con arguments? |
|
I've just installed Vimium on Firefox, it works great. So maybe install Firefox :). |
|
As far as I understand, it's browser or vimium problem. But if we do this, it makes sense to use separate key, for example: |
|
Yeah it is a Chrome bug. In general, Chrome cares only very little about the But why should firefox users being made suffer? Firefox works great, but http://localhost is far more inconvenient than file protocol based services. |
|
having a built-in server would be really useful for those that usually work inside a ssh session/vm and use a browser outside the shell session. |
Why trying to squash the universe inside one tool? Let cargo doc generate documentation, let another tool host it. |
|
This gist has some one-liners for spinning up a web server for static content: eg:
will spin up an http server on 0.0.0.0:8000 (potentially world accessible; take appropriate care!). It's not as convenient as While I'm on the fence about building this support directly into cargo, it would be nice if there was an easy way to do this, or that the docs/help pushed folks towards a couple of nice recipes to help with this use case. |
|
I'm hacking together a |
|
just pushed https://crates.io/crates/cargo-docserver, hopefully that's useful for someone besides me |
|
@qmx it works, thanks! |
|
Probably if it is an edge case scenario, you can use https://www.npmjs.com/package/serve to serve your docs to a localhost and then open that in chrome(ium). This is much simpler solution than building a server inside cargo itself. |
This comment was marked as disruptive content.
This comment was marked as disruptive content.
This comment was marked as disruptive content.
This comment was marked as disruptive content.
No I haven't. What I meant with the suggestion was that cargo is not meant to be a server. Including an http server just to view docs on localhost doesn't make much sense when there are libraries such as cargo-docserver. I was just suggesting a simple solution in terms of the time it would take for someone to use it. Granted it is simple only for those who already have node installed, but it is a simple solution nonetheless. |
Running
cargo doc --opencurrently opens the file in the browser with thefile://protocol.In this protocol, web extensions like Vimium don't have access to the page and can't provide keyboard shortcuts.
It would be nice if running
cargo doc --openwould start a web server like http then navigate to the generated index file. I've tested that and Vimium works normally. Thank you!