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

Implement a web backend for rustdoc_ng #9374

Merged
merged 1 commit into from
Sep 21, 2013

Conversation

alexcrichton
Copy link
Member

This large commit implements and html output option for rustdoc_ng. The
executable has been altered to be invoked as "rustdoc_ng html " and
it will dump everything into the local "doc" directory. JSON can still be
generated by changing 'html' to 'json'.

This also fixes a number of bugs in rustdoc_ng relating to comment stripping,
along with some other various issues that I found along the way.

The make doc command has been altered to generate the new documentation into
the doc/ng/$(CRATE) directories.

Previews

Missing features

  • Different versions of documentation on the same page (all possibly indexed as well?) I think that this needs to be thought out before action is taken. It's an awesome idea, but it should be done carefully.
  • Source links are missing. This is a little dependent on getting versions working. In theory we should link back to github, but we should always link back to the exact version the documentation was generated from.
  • Integration with other tools. It would be awesome to have rustpkg-style inference of the package name and version so they don't have to be specified anywhere. Additionally, I should be able to build documentation for a pkgid, not necessarily a crate file.

cc @cmr/@Seldaek

@alexcrichton
Copy link
Member Author

A couple of cool things:

  • I managed only hit one ICE while writing all this code. Either rust is getting stable or I'm subconciously trained to avoid particular patterns. I have a terrible memory, so I think rust is stabilizing!
  • This is some seriously heavy usage of the new format! syntax extension. I really enjoyed using it, although I could be biased... I'm seeing rays of light for an HTML formatting library which escapes everything by default, but I couldn't quite wrap my head around doing so.
  • The formatting of all the code into html templates is ugly as sin. This could seriously benefit from a formatting library.
  • I thought include_str! was cool

Regardless, carry on!

@alexcrichton
Copy link
Member Author

Also, this would seriously benefit from a markdown C library as opposed to forking off and executing pandoc. We're not really using any of pandoc's fancy extensions any more (except for all the tutorial/manual generation), so we're less attached to it now than before.

The reason it needs to be a C library is that instead of forking pandoc once per page, now it's once per docblock which is a lot more often. I've parallelized everything among a set number of workers, so it's not as bad as it could be, but it's still pretty bad.

@alexcrichton
Copy link
Member Author

And of course, mad props to @cmr and @Seldaek for all their awesome work!

@thestinger
Copy link
Contributor

You can use pandoc to compile small fragments without forking more than one process for it, since it's a library.

@alexcrichton
Copy link
Member Author

@thestinger that would be awesome, but it wasn't clear to me at first how to do that. @Seldaek suggested coalescing a number of rendering requests into one batch to send to pandoc, but that was difficult to implement so I didn't end up doing it. If I could keep a long-running pandoc process running though, that'd be awesome.

bors added a commit that referenced this pull request Sep 21, 2013
This large commit implements and `html` output option for rustdoc_ng. The
executable has been altered to be invoked as "rustdoc_ng html <crate>" and
it will dump everything into the local "doc" directory. JSON can still be
generated by changing 'html' to 'json'.

This also fixes a number of bugs in rustdoc_ng relating to comment stripping,
along with some other various issues that I found along the way.

The `make doc` command has been altered to generate the new documentation into
the `doc/ng/$(CRATE)` directories.

Previews
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/extra/

Missing features
* Different versions of documentation on the same page (all possibly indexed as well?) I think that this needs to be thought out before action is taken. It's an awesome idea, but it should be done carefully.
* Source links are missing. This is a little dependent on getting versions working. In theory we should link back to github, but we should always link back to the exact version the documentation was generated from.
* Integration with other tools. It would be awesome to have rustpkg-style inference of the package name and version so they don't have to be specified anywhere. Additionally, I should be able to build documentation for a pkgid, not necessarily a crate file.

cc @cmr/@Seldaek
@steveklabnik
Copy link
Member

Ive also been thinking about an HTML auto-escaping library....

This large commit implements and `html` output option for rustdoc_ng. The
executable has been altered to be invoked as "rustdoc_ng html <crate>" and
it will dump everything into the local "doc" directory. JSON can still be
generated by changing 'html' to 'json'.

This also fixes a number of bugs in rustdoc_ng relating to comment stripping,
along with some other various issues that I found along the way.

The `make doc` command has been altered to generate the new documentation into
the `doc/ng/$(CRATE)` directories.
bors added a commit that referenced this pull request Sep 21, 2013
This large commit implements and `html` output option for rustdoc_ng. The
executable has been altered to be invoked as "rustdoc_ng html <crate>" and
it will dump everything into the local "doc" directory. JSON can still be
generated by changing 'html' to 'json'.

This also fixes a number of bugs in rustdoc_ng relating to comment stripping,
along with some other various issues that I found along the way.

The `make doc` command has been altered to generate the new documentation into
the `doc/ng/$(CRATE)` directories.

Previews
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/extra/

Missing features
* Different versions of documentation on the same page (all possibly indexed as well?) I think that this needs to be thought out before action is taken. It's an awesome idea, but it should be done carefully.
* Source links are missing. This is a little dependent on getting versions working. In theory we should link back to github, but we should always link back to the exact version the documentation was generated from.
* Integration with other tools. It would be awesome to have rustpkg-style inference of the package name and version so they don't have to be specified anywhere. Additionally, I should be able to build documentation for a pkgid, not necessarily a crate file.

cc @cmr/@Seldaek
@bors bors closed this Sep 21, 2013
@bors bors merged commit 4fd061c into rust-lang:master Sep 21, 2013
Jarcho pushed a commit to Jarcho/rust that referenced this pull request Aug 29, 2022
uninit_vec: Vec::spare_capacity_mut is stable

Quick documentation fix: `Vec::spare_capacity_mut` no longer needs nightly.

changelog: none
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

Successfully merging this pull request may close these issues.

4 participants