GithubHelp home page GithubHelp logo

sergiobenitez / docs.rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rust-lang/docs.rs

0.0 2.0 0.0 1.16 MB

crates.io documentation generator

Home Page: https://docs.rs/

License: MIT License

Rust 81.44% HTML 12.73% CSS 5.84%

docs.rs's Introduction

Docs.rs

Build Status License

Docs.rs (formerly cratesfyi) is an open source project to host documentation of crates for the Rust Programming Language.

Docs.rs automatically builds crates' documentation released on crates.io using the nightly release of the Rust compiler.

The README of a crate is taken from the readme field defined in Cargo.toml. If a crate doesn't have this field, no README will be displayed.

Redirections

Docs.rs is using semver to parse URLs. You can use this feature to access crates' documentation easily. Example of URL redirections for clap crate:

URL Redirects to documentation of
https://docs.rs/clap Latest version of clap
https://docs.rs/clap/~2 2.* version
https://docs.rs/clap/~2.9 2.9.* version
https://docs.rs/clap/2.9.3 2.9.3 version (you don't need = unlike semver)

The crates.fyi domain will redirect to docs.rs, supporting all of the redirects discussed above

Badges

You can use badges to show state of your documentation to your users. The default badge will be pointed at the latest version of a crate. You can use version parameter to show status of documentation for any version you want.

Badge will display in blue if docs.rs is successfully hosting your crate documentation, and red if building documentation failing.

Example badges for mio crate:

URL Badge
Latest version: https://docs.rs/mio/badge.svg mio
Version 0.4.4: https://docs.rs/mio/badge.svg?version=0.4.4 mio
Version 0.1.0: https://docs.rs/mio/badge.svg?version=0.1.0 mio

Development

We strongly recommend using vagrant, this will give you a virtual machine already configured and ready to start developing on.

Getting started

Make sure you have vagrant, virtualbox and a ssh client and you need to able to download ~800MB data on the first run.

git clone https://github.com/rust-lang/docs.rs.git docs.rs
cd docs.rs
vagrant up  # This may take a little while on the first run

You can always run vagrant provision to reconfigure virtual machine. Provision will install required dependencies and nightly rust compiler into virtual machine. It will also configure lxc-container inside virtual machine.

CLI

Make sure you are running every listed command inside /vagrant directory in virtual machine. You can connect to virtual machine with vagrant ssh and switch current working directory with: cd /vagrant inside virtual machine.

Starting web server

This command will start web interface of docs.rs and you can access it from: http://localhost:3000/

cargo run -- start-web-server

build subcommand

# Builds <CRATE_NAME> <CRATE_VERSION> and adds it into database
# This is the main command to build and add a documentation into docs.rs.
cargo run -- build crate <CRATE_NAME> <CRATE_VERSION>


# Adds essential files (css and fonts) into database to avoid duplication
# This command needs to be run after each rustc update
cargo run -- build add-essential-files


# Builds every crate and adds them into database
# (beware: this may take months to finish)
cargo run -- build world

database subcommand

# Migrate database to recent version
cargo run -- database migrate


# Adds a directory into database to serve with `staticfile` crate.
cargo run -- database add-directory <DIRECTORY> [PREFIX]


# Updates github stats for crates.
# You need to set CRATESFYI_GITHUB_USERNAME, CRATESFYI_GITHUB_ACCESSTOKEN
# environment variables in order to run this command.
# You can set this environment variables in ~/.cratesfyi.env file.
cargo run -- database update-github-fields


# Updates search-index.
# daemon is running this command occasionally, and this command must be
# run to update recent-version of a crate index and search index.
# If you are having any trouble with accessing right version of a crate,
# run this command. Otherwise it's not required.
cargo run -- database update-search-index


# Updates release activitiy chart
cargo run -- database update-release-activity

If you want to explore or edit database manually, you can connect database with psql command.

doc subcommand

This subcommand will only build documentation of a crate. It is designed to run inside a secure container.

cargo run -- doc <CRATE_NAME>

Contact

Docs.rs is run and maintained by Rustdoc team. You can find us in #docs-rs on Discord.

docs.rs's People

Contributors

alanhdu avatar bluss avatar bnjjj avatar byron avatar caulagi avatar decathorpe avatar durka avatar frewsxcv avatar guillaumegomez avatar hadronized avatar iliekturtles avatar jonas-schievink avatar jonhoo avatar kivikakk avatar kodraus avatar kyrias avatar mattyhall avatar nemikolh avatar notriddle avatar onur avatar passy avatar quietmisdreavus avatar samueltardieu avatar spk avatar tesuji avatar tisonkun avatar w-culhane avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.