New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`cargo doc --open` should start a web server to enable keyboard accessibility #4966

Open
kbdluv opened this Issue Jan 21, 2018 · 11 comments

Comments

Projects
None yet
7 participants
@kbdluv

kbdluv commented Jan 21, 2018

Running cargo doc --open currently opens the file in the browser with the file:// 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 --open would start a web server like http then navigate to the generated index file. I've tested that and Vimium works normally. Thank you!

@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

steveklabnik Jan 21, 2018

Member

This has historically been controversial. I'm pro, but there are a lot of people against.

Member

steveklabnik commented Jan 21, 2018

This has historically been controversial. I'm pro, but there are a lot of people against.

@kbdluv

This comment has been minimized.

Show comment
Hide comment
@kbdluv

kbdluv Jan 22, 2018

What are the con arguments?

kbdluv commented Jan 22, 2018

What are the con arguments?

@est31

This comment has been minimized.

Show comment
Hide comment
@est31

est31 Jan 22, 2018

Contributor

I've just installed Vimium on Firefox, it works great. So maybe install Firefox :).

Contributor

est31 commented Jan 22, 2018

I've just installed Vimium on Firefox, it works great. So maybe install Firefox :).

@chabapok

This comment has been minimized.

Show comment
Hide comment
@chabapok

chabapok Jan 30, 2018

Contributor

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: cargo doc --open_with_embedded_webserver

Contributor

chabapok commented Jan 30, 2018

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: cargo doc --open_with_embedded_webserver

@est31

This comment has been minimized.

Show comment
Hide comment
@est31

est31 Jan 31, 2018

Contributor

Yeah it is a Chrome bug. In general, Chrome cares only very little about the file:// protocol: https://bugs.chromium.org/p/chromium/issues/detail?id=47416

But why should firefox users being made suffer? Firefox works great, but http://localhost is far more inconvenient than file protocol based services.

Contributor

est31 commented Jan 31, 2018

Yeah it is a Chrome bug. In general, Chrome cares only very little about the file:// protocol: https://bugs.chromium.org/p/chromium/issues/detail?id=47416

But why should firefox users being made suffer? Firefox works great, but http://localhost is far more inconvenient than file protocol based services.

@qmx

This comment has been minimized.

Show comment
Hide comment
@qmx

qmx Feb 24, 2018

Member

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.

Member

qmx commented Feb 24, 2018

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.

@pravic

This comment has been minimized.

Show comment
Hide comment
@pravic

pravic May 25, 2018

for those that usually work inside a ssh session/vm

Why trying to squash the universe inside one tool? Let cargo doc generate documentation, let another tool host it.

pravic commented May 25, 2018

for those that usually work inside a ssh session/vm

Why trying to squash the universe inside one tool? Let cargo doc generate documentation, let another tool host it.

@wez

This comment has been minimized.

Show comment
Hide comment
@wez

wez Jul 20, 2018

This gist has some one-liners for spinning up a web server for static content:
https://gist.github.com/willurd/5720255

eg:

cargo doc && cd target/doc && python3 -m http.server 8000

will spin up an http server on 0.0.0.0:8000 (potentially world accessible; take appropriate care!).

It's not as convenient as cargo doc --open but it's not super terrible.

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.

wez commented Jul 20, 2018

This gist has some one-liners for spinning up a web server for static content:
https://gist.github.com/willurd/5720255

eg:

cargo doc && cd target/doc && python3 -m http.server 8000

will spin up an http server on 0.0.0.0:8000 (potentially world accessible; take appropriate care!).

It's not as convenient as cargo doc --open but it's not super terrible.

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.

@qmx

This comment has been minimized.

Show comment
Hide comment
@qmx

qmx Jul 20, 2018

Member

I'm hacking together a cargo docserver for this, hopefully it gets somewhere 🙏

Member

qmx commented Jul 20, 2018

I'm hacking together a cargo docserver for this, hopefully it gets somewhere 🙏

@qmx

This comment has been minimized.

Show comment
Hide comment
@qmx

qmx Jul 23, 2018

Member

just pushed https://crates.io/crates/cargo-docserver, hopefully that's useful for someone besides me

Member

qmx commented Jul 23, 2018

just pushed https://crates.io/crates/cargo-docserver, hopefully that's useful for someone besides me

@wez

This comment has been minimized.

Show comment
Hide comment
@wez

wez Jul 23, 2018

@qmx it works, thanks!

wez commented Jul 23, 2018

@qmx it works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment