/rd

Experimental rustdoc json front-end

Primary LanguageRustOtherNOASSERTION

rd

github license build status

This project is a POC/experimental frontend for the rustdoc json output format to generate html documentation.

⚠️ This project is currently broken for newer rustdoc (>=2023)! ⚠️

Demos

Features

  • Pretty printing of items (methods, structs, traits, ...)
  • Minimal self-contained search engine with index
  • Bootstrap 5 html pages
  • Syntax highlighting of items
  • Navigation between items (even external if available)
  • Improved markdown output (similar to rustdoc)
  • Table of contents (markdown + items)
  • Deprecation notice and attributes filtering
  • cfg and doc printing
  • Themes (currently light and black)
  • [] Generation of the global index.html
  • [] Handling of re-export(s) (Mostly done, but links to them won't work)
  • Source code inclusion
  • Options/customization

Usage

rd 0.1.0
Commande-line options

USAGE:
    rd [FLAGS] <FILE>... --output <output>

FLAGS:
    -h, --help       Prints help information
        --open       Open the generated documentation if successful
    -V, --version    Prints version information
    -v, --verbose    Verbose mode (-v, -vv, -vvv, etc.)

OPTIONS:
    -o, --output <output>    Output directory of html files

ARGS:
    <FILE>...    Rustdoc json input file to process

Generating a rustdoc-json output

Generating the json output format currently requires a nightly toolchain.

$ RUSTDOCFLAGS="-Z unstable-options --output-format json" cargo +nightly doc

You should see in the target/doc directory a file called MY_CRATE.json, that's the json rustdoc output. This file will be used by rd to generate the documentation.

Generating the HTML output with rd

$ cargo run -- -v --output html/ --open my_crate.json

License

Licensed under the BSD+Patent license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, shall be licensed under the BSD+Patent license without any additional terms or conditions.