Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate rustdoc from README? #72

Open
seanpianka opened this issue Oct 2, 2021 · 1 comment
Open

Generate rustdoc from README? #72

seanpianka opened this issue Oct 2, 2021 · 1 comment

Comments

@seanpianka
Copy link

seanpianka commented Oct 2, 2021

My project uses #![doc = include_str!("../README.md")] to generate the rustdoc for the crate from its README. However, I noticed a user forked it just to remove this line, ostensibly since they're using a Rust version < 1.54.

Does this crate support this opposite direction for the doc generation? For example, outputting rustdoc comments to stdout, or automatically replacing src/lib.rs rustdoc with the result.

I suppose I can also just convert the markdown to rustdoc manually, but I'm curious about a tool for this. Thanks!

@danielhenrymantilla
Copy link

danielhenrymantilla commented Jan 15, 2022

@seanpianka I can't speak of this crate, but what you can do is feature-gat that include_str! of yours:

#![cfg_attr(feature = "better-docs",
    cfg_attr(all(), doc = include_str!("../README.md")),
)]

with some better-docs = [] feature in your crate which can be enabled by docs.rs:

[features]
# ...

better-docs = []  # unstable

[package.metadata.docs.rs]
features = ["better-docs"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants