Simplify doc management and update READMEs - #208
Merged
Conversation
Member
Author
|
Also as a side bonus, README examples are not compilable, which makes it easier to track outdated code. |
Contributor
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
jsturtevant
reviewed
Oct 4, 2023
jsturtevant
left a comment
Contributor
There was a problem hiding this comment.
I looked but I didn't see where the docs get compiled on a PR, is it cargo doc that passes the feature?
| limitations under the License. | ||
| */ | ||
|
|
||
| #![cfg_attr(feature = "docs", doc = include_str!("../README.md"))] |
Contributor
There was a problem hiding this comment.
does this need the `//!`` so it formats properly?
Member
Author
There was a problem hiding this comment.
No, we can include markdown directly here.
You can verify the final result with:
cargo doc --no-deps --features docs --openSigned-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Member
Author
I've updated CI to verify readmes with Github actions. The [package.metadata.docs.rs]
features = ["docs"] |
Contributor
|
LGTM |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 4, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently we manage root documentation for each crate in 2 places: crate's README.md on Github and module's root documentation (comments that start with
//!) that gets uploaded to docs.rs. Typically this is the same text that needs to be present in 2 places.This PR aims to simplify this flow and uses README.md in both places, so there is no need to sync docs. When building, each crate will use
include_str!="README.dm"macro to include the latest docs from the file.I avoid extra work on local environments, this feature is hidden behind
docstoggle, which is automatically enabled when building documentation for docs.rs.