It is very common that a crate may provide one single README.md
for both GitHub main page, crates.io main page, root-level rustdoc, and even mdbook preface. Moreover, both rustdoc and mdbook provide capability to conduct doc tests on Rust codes in README, which is helpful to make sure that the codes provided in Usage or Example work as it is.
However, to make the doc test work, we must provide a whole working code snippet, which involves many items that distract readers (for example, we may want just a struct name or function name, but we need to explicitly define those items). Rustdoc and mdbook support to add a #
prefix in the line to indicate the line is hidden from readers. While GitHub and crates.io do not support this, and readers from those platform will see ugly #
lines.
I wonder what is the best practice to provide such README file, which can be doc tested and not to distract GitHub and crates.io readers by the #
lines.