Crate cradoc

Crate cradoc 

Source
Expand description

cradoc (a mot-valise for crate doc) leverages Rust’s documentation generation to automatically maintain other documents up to date.

The current version of cradoc does only one thing: ensure markdown files in your repo (eg the README.md) contain an up-to-date version of the crate documentation.

Insert <!-- cradoc --> in your markdown file where you want the crate documentation to appear, run cradoc in your repo, and the markdown file will be updated accordingly.

There are several previous crates with the same exact feature, most especially cargo-readme. It’s very probable the crate you need is one of those previous ones.

The main reason I made this alternative is that cargo-readme does not currently properly handle intra-links (this is being worked on, don’t discard this much more mature crate).

To see an example of what cradoc produces, head up to the readme of lazy-regex. This README full of links is made from the crate’s lib.rs which is also used for the crate documentation.

(other features should come later)

Structs§

Args
Launch arguments
Context
Holds all the context information about a crate needed to generate or update other documents

Enums§

CradError

Functions§

build_and_read_json_doc
Build the crate documentation in JSON format and read it into a rustdoc_types::Crate struct
build_html_doc
Build the crate documentation in HTML format and return the path to the directory holding all docs (one subdir per crate)
extract_links
Extract all links from an HTML file and returns them as a map of link text to URL
find_crate_item
run
run_cargo_command
Build the crate documentation in JSON format and read it into a rustdoc_types::Crate struct
url_is_relative
Return true if the given URL is relative (does not start with http:// or https://)

Type Aliases§

CradResult