Skip to content
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

Pull the cargo docs out of tree and convert them to mdBook #4040

Closed
carols10cents opened this issue May 13, 2017 · 20 comments
Closed

Pull the cargo docs out of tree and convert them to mdBook #4040

carols10cents opened this issue May 13, 2017 · 20 comments

Comments

@carols10cents
Copy link
Member

Part of rust-lang/rust#39588. I didn't see an issue for this yet @steveklabnik so I made one :)

@carols10cents
Copy link
Member Author

@istankovic is working on a draft of this over here! https://github.com/istankovic/cargo-book

@behnam
Copy link
Contributor

behnam commented Aug 8, 2017

Here's an old PR for this: #4220

The content of pages have been updated since this PR and the fork. Not sure how they're going to be handled.

@istankovic
Copy link

Heh, just the other day I spent quite some time porting the doc changes made in the meantime to my branch. And now there are additional changes, which I don't mind, really, but I'd like to avoid unnecessary work, if possible. Is there another effort to move the cargo docs to mdbook, that I am not aware of?

@behnam
Copy link
Contributor

behnam commented Aug 8, 2017

I don't know about the migrations, but have been updating the docs recently, because of code changes and improving readability.

@istankovic
Copy link

@behnam would you be willing to take over the migration effort? 😄
The way I see it, you're currently updating the docs faster than I can keep up and there's also the fact that I don't have much time, which means the migration will not be done soon.

@behnam
Copy link
Contributor

behnam commented Aug 8, 2017

@istankovic Would be glad to help with Cargo's migration. Although, I haven't worked with mdBook yet and not sure what the plans are overall.

Specifically, I have updated cargo docs to get the online docs like http://doc.crates.io/manifest.html updated, which is considered the reference for manifest syntax. What do we expect to happen to these URLs with the migration?

/ping @carols10cents

@istankovic
Copy link

istankovic commented Aug 8, 2017

Well, the idea here is to make Cargo docs more like other books, see rust-lang/rust#39588. So you can take a look at how the other books look now, it's very straightforward. You can also checkout the doc-migration branch and run mdbook serve in the book directory to see how it looks like.

The good news is the migration is almost done (modulo your latest changes). The only thing that I did not yet figure out is what to do with the script that builds the docs. This is also probably related to your question about the URLs. Maybe @steveklabnik can give some advice here.

One thing to note is that, unlike other books, this will not be in a separate repo, see the related discussion in the PR.

@carols10cents
Copy link
Member Author

Ok, we talked about this in the cargo team meeting today, and this sort of affects the book too. Here's what we discussed:

  • We'd like cargo docs to be available somewhere on doc.rust-lang.org rather than doc.crates.io
  • We'd like to have this doc.rust-lang.org URL working for stable cargo docs before december, when the book is getting printed
  • To get this on stable, we need to get this done in the next 3 weeks
  • That's really quickly
  • For now, we can set up a doc.rust-lang.org URL that will redirect to doc.crates.io so that we can use the doc.rust-lang.org URL in the book
  • That gives us more time to actually convert the cargo docs to mdbook and set up building/deployment through rust-lang/rust (as discussed in Doc migration #4220) and have it ride the trains
  • When we're ready, we can make the redirects go from doc.crates.io to doc.rust-lang.org instead

I am going to ask the doc team what URL they'd like for the cargo docs, and then I'd like help/pointers from @alexcrichton to set up said redirect to doc.crates.io, and then I can help with getting #4220 rebased and merged in as peoples' schedules allow (but that isn't as urgent as the first two).

Anything I'm forgetting?

@carols10cents
Copy link
Member Author

Any objections to doc.rust-lang.org/cargo? cc @rust-lang/docs

@behnam
Copy link
Contributor

behnam commented Aug 10, 2017

Sounds like a good plan, @carols10cents!

One question: @istankovic mentioned that the new structure is almost ready for the book format, and there's already plenty of the content there, some of which needing updates from upstream. So, it is possible right now to host the new repo on <doc.rust-lang.org>, in an unstable form, and make that the source of truth whenever the content is up-to-date and redirects are set for it from <doc.crates.io>. This way, there's no need to set up redirects in the other direction. Have you considered this option? (I'm curious what may be preventing the new repo going online right now.)

@carols10cents
Copy link
Member Author

(I'm curious what may be preventing the new repo going online right now.)

Since the new structure is going to be deployed through rust-lang/rust, it has to ride the trains. That means it'll only be available at doc.rust-lang.org/nightly/cargo at first, then doc.rust-lang.org/beta/cargo the first time beta branches after that PR makes it in, then doc.rust-lang.org/cargo 6 weeks after that. We want to have a URL to print in the book that needs to definitely go somewhere sometime before December (I don't know when the REALLY hard deadline for that is). I don't want to rush the PR converting the docs because of the book. So for now, we're just going to set up the redirect from doc.rust-lang.org/cargo -> doc.crates.io, make sure that gets into the very next beta, print the doc.rust-lang.org/cargo URL in the book, and then have plenty of time to make the converted docs the way we want them without rushing.

Does that make sense?

@behnam
Copy link
Contributor

behnam commented Aug 10, 2017

Got it! So it's the release schedule for the new repo. Totally makes sense. :)

@istankovic
Copy link

Sounds reasonable to me. Still, I'd like to point out once more that the docs are mostly converted. The only changes needed are to port doc updates made by @behnam, which should not be a big deal, and to deal with the infrastucture (build script etc.).

@behnam, if you're willing to do it, I'd be more than happy to hand over the doc-migration effort.

@behnam
Copy link
Contributor

behnam commented Aug 10, 2017

Sure, @istankovic. I can help with that. Would you please also give me some pointers, specially which other docs repo is a good example to look at, specially for build process/scripts?

@istankovic
Copy link

You can take a look at how I transferred doc changes here: https://github.com/istankovic/cargo-book/commits/master. For each doc commit in cargo I have a commit in cargo-book which is mostly copy-paste. I changed the original structure somewhat so you need to find appropriate places for the changes, but it is pretty straightforward. Also keeping references up to date should not be a big deal.

@behnam behnam mentioned this issue Aug 11, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Aug 17, 2017
…=alexcrichton

Implement a temp redirect for cargo docs

As discussed in
rust-lang/cargo#4040 (comment)

This is a redirect meant to be replaced once cargo docs have been
converted to mdbook. We just want *a* URL to ride the trains for now so
that we can print doc.rust-lang.org/cargo in the paper book and
guarantee that it will go *somewhere* useful by the time the book is
printed.

Implemented as a meta redirect in HTML because we don't currently have
any google juice at doc.rust-lang.org/cargo to lose.

When I run `./x.py doc`, this creates a `build/x86_64-apple-darwin/doc/cargo/index.html` file that contains a meta redirect to doc.crates.io. As I understand rust-central-station to work, this should be what we need to make `doc.rust-lang.org/cargo` to work.

r? @alexcrichton and/or @steveklabnik
@behnam
Copy link
Contributor

behnam commented Aug 31, 2017

We have decided to keep the docs in-repo. We can update the title of this issue.

And the first PR is here: #4453

@behnam
Copy link
Contributor

behnam commented Aug 31, 2017

bors added a commit that referenced this issue Aug 31, 2017
Import mdBook-based docs and sync

Since we decided to keep the mdBook-based docs in-repo, I have imported the existing converted docs from <https://github.com/istankovic/cargo-book> under `/src/doc/book/` here, and have synced the current docs and the mdBook-based ones manually, file-by-file.

I have created a `MIGRATION_MAP` file, which shows the relationship between old docs and new ones. The first column is the old file, the second column is the canonical location in mdBook, and the rest of columns are globs of other files in mdBook containing content from the old file.

The first and second column of `MIGRATION_MAP` shall later be used to create redirect rules from `doc.crates.io/` to `doc.rust-lang.org/cargo/`.

I will also add a README file to remind everyone to keep these files in sync during the migration.

There are also two or three small wording fixes here, which I'll note inline.

This is a retry of <#4220>.

First step for <#4040>.
bors added a commit that referenced this issue Sep 1, 2017
[doc/book] Add introduction page and other enhancements

Preview: http://code.behnam.es/rust-cargo/book/

* Reorganize files to use folders instead of numbered files. This will allow us to add new sections and pages without breaking a numbering system or the URLs.

* Rename "Cargo In Depth" to "Cargo Reference", as those pages are considered *the* reference for cargo behaviors.

* Add `introduction.md`, as the landing page with the book title and Cargo logo on top.

* Expand `installation.md`: Import install text and links from <https://crates.io/install>, as we
want to drop that page and redirect it to here. (See <rust-lang/crates.io#1029>)

* Sync `SUMMARY.md` titles (and sub-pages lists in section pages) with page titles and fix some wordings and casings.

* Expand Introduction and section pages with some intro text.

* Set lang for some of the code blocks.

* Add `book.toml` to get the title in HTML head title, etc.

Tracker: <#4040>
bors added a commit that referenced this issue Sep 1, 2017
[doc] Publish book to gh-pages

Export mdBook into `target/doc/book/`, to make it accessible at <http://doc.crates.io/book/>

I have tested the changes on my repo (but when I had this commit on top of the other PR) locally. The result is at <http://code.behnam.es/rust-cargo/book/>.

Tracker: <#4040>
@behnam
Copy link
Contributor

behnam commented Sep 2, 2017

Preview is now live here: http://doc.crates.io/book/

mdBook has a major issue with in-page link generation and we need to wait until the fix lands and makes it to a release, before we add it to the bookshelf. (Upstream fix: https://github.com/azerupi/mdBook/pull/419)

I'm also addressing some other small issues and looking forward to more feedback.

behnam added a commit to behnam/rust-cargo that referenced this issue Sep 2, 2017
We don't need to put `policies.md` in the book. See
<rust-lang/crates.io#1030> for more.

Renaming `introduction.md` to `index.md` prevents creating two html
files (and URL) for one source.

The rest are small styling issues.

Tracker: <rust-lang#4040>
bors added a commit that referenced this issue Sep 2, 2017
[doc/book] Drop reference/policies.md and small fixes

We don't need to put `policies.md` in the book. See
<rust-lang/crates.io#1030> for more.

Renaming `introduction.md` to `index.md` prevents creating two html
files (and URL) for one source.

The rest are small styling issues.

Tracker: <#4040>
@behnam
Copy link
Contributor

behnam commented Sep 28, 2017

Okay, let's close this issue in favor of the follow up here: rust-lang/rust#44910

@alexcrichton
Copy link
Member

Sounds great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants