|
| 1 | +# The Rustdoc 2019 Roadmap |
| 2 | + |
| 3 | +As one of the core tools that affects how people perceive Rust both inside and outside the |
| 4 | +community, it's important that we maintain rustdoc's reputation as one of the best API documentation |
| 5 | +generators. There are a number of in-progress features and numerous incoming feature requests that |
| 6 | +we need to balance between our limited resources and the existing tool design. That said, we believe |
| 7 | +there are a number of improvements we can make in a year that will help us continue to deserve that |
| 8 | +hard-earned reputation. |
| 9 | + |
| 10 | +In keeping with the growing theme of "**maturity**" coming from around the project, this year the |
| 11 | +Rustdoc Team will focus on *finishing what we've started*, *polishing what we have*, and *getting |
| 12 | +rustdoc in more and more places*. Put more concretely, here are our priorities in 2019: |
| 13 | + |
| 14 | +* Pushing existing unstable features to completion |
| 15 | +* Improving documenatation tests |
| 16 | +* Reviving JSON output |
| 17 | +* Experimenting with an archive and server to emit fewer files |
| 18 | + |
| 19 | +Each of these items is either an extension to an existing feature in rustdoc, or included to address |
| 20 | +prominent issues faced by production users and large portions of the community. By pushing these |
| 21 | +features, rustdoc can grow with the community as Rust gains more and more users. |
| 22 | + |
| 23 | +To provide some extra detail for each item: |
| 24 | + |
| 25 | +## Pushing existing unstable features |
| 26 | + |
| 27 | +There are (at least) three high-profile unstable features for rustdoc that are partially |
| 28 | +implemented. All these features are seeing a fair amount of use already in the community, and they |
| 29 | +work well for most situations. But for each one, there's some implementation problem that is keeping |
| 30 | +it from being pushed all the way to stabilization. For this year, the Rustdoc Team would like to |
| 31 | +coordinate efforts to push these features to their fullest, and call for their stabilization: |
| 32 | + |
| 33 | +* Intra-doc links |
| 34 | +* Cross-platform docs with `#[doc(cfg)]` |
| 35 | +* Documentation management with `#[doc(include)]` |
| 36 | + |
| 37 | +## Improving documentation tests |
| 38 | + |
| 39 | +Documentation tests (commonly called "doctests") are one of the most powerful features of rustdoc. |
| 40 | +The ability to ensure that code samples written into documentation are always valid code creates |
| 41 | +confidence in documentation that won't go out of sync with the code it's describing. That said, |
| 42 | +there are still places where doctest code can be improved, or new features added to make them more |
| 43 | +useful in situations where they're not available today. For this year, the Rustdoc Team would like |
| 44 | +to create a "Doctests Working Group" to focus on improvements to the doctest system. Some initial |
| 45 | +ideas put forth include: |
| 46 | + |
| 47 | +* Cross-compilation of doctests |
| 48 | +* Improvements in doctest error reporting |
| 49 | +* Refactoring [code detection][] to properly handle more kinds of code |
| 50 | + |
| 51 | +[code detection]: https://quietmisdreavus.net/code/2018/02/23/how-the-doctests-get-made/ |
| 52 | + |
| 53 | +## JSON output |
| 54 | + |
| 55 | +Several years ago, rustdoc supported outputing JSON in addition to its usual HTML. However, the old |
| 56 | +implementation of it was buggy and incomplete, so it was eventually removed. This hasn't stopped |
| 57 | +people from desiring the feature, though. Having a machine-readable format of the API of a crate |
| 58 | +that focused on its documentation would allow Rust documentation to be more easily integrated into |
| 59 | +other documentation hosts, or to allow the creation of alternative "frontends" that consume the JSON |
| 60 | +to create a different output from rustdoc's classic static HTML files. For this year, the Rustdoc |
| 61 | +Team would like to investigate the revival of JSON output and create an initial implementation, to |
| 62 | +allow users to experiment with the format. |
| 63 | + |
| 64 | +## Experimental archive format output |
| 65 | + |
| 66 | +One of the biggest performance problems facing rustdoc, especially on Windows, is the fact that it |
| 67 | +generates at least one file per documentable "item" in the crate. This is a result of the fact that |
| 68 | +rustdoc acts like a static site generator, creating a plain set of web pages from its input. This |
| 69 | +combines with the design of the output site to give each item its own webpage to breathe to force |
| 70 | +the creation of so many files. One solution to this problem is to make rustdoc output an |
| 71 | +intermediate format, like the aforementioned JSON. This could offload the presentation layer to |
| 72 | +something that can take an alternate direction with the design of the site. |
| 73 | + |
| 74 | +Another way is to change the encoding of the files on disk. Last year, an [experimental web |
| 75 | +server][] was created that used a custom archive format to stream compressed files directly without |
| 76 | +decompressing the files and recompressing them again. It was made to serve rustdoc HTML output |
| 77 | +effeciently, and demonstrates its use in documentation by compressing documentation created by |
| 78 | +rustdoc. For this year, the Rustdoc Team would like to investigate extending its custom archive |
| 79 | +format and emitting it natively, so that users can reap the benefits of the file server without |
| 80 | +having to emit all the HTML files first. |
| 81 | + |
| 82 | +[experimental web server]: https://github.com/killercup/static-filez |
0 commit comments