rustdoc

Generate markdown docs with rustdoc?


Is there any way to generate a single markdown file in doc/ from the /// comments?

Multiple markdown files (doc/main.md, doc/foo.md, etc) would be nice too.

I'm new to rust, and while the generated HTML documentation is nice, I mostly live on the command line and really don't want to be switching between my terminal and a web browser just to read the docs. That breaks the flow and takes me out of the zone. Also, md is easily converted to man pages, or to TeX for printed or PDF docs.

(I'm used to suspending vim with Ctrl-Z or using another terminal tab, and running man or perldoc or pydoc etc. Text-mode browsers like lynx nor links are not good options for me - navigation is clumsy, the output is ugly on my 200+ column terminals windows if i forget to use the -width option, and neither support javascript)


Solution

  • cargo-readme might work for you. You run cargo readme -i foo.rs > FOO.md and it populates FOO.md with the contents of the doc comments from foo.rs. Found it via reddit.