-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
docs: link examples & tutorial of right version on docs.rs #497
Conversation
I just realized that |
(And it would probably make sense to backport this to the |
Thanks! Do you have any external information I could read about this technique? Feel free to ignore |
The technique relies on former link definitions taking precedence over latter link definitions which is specified by CommonMark, see example 204. Rustdoc uses the
Ah right ... I see that the new guide does exactly what I suggested (being part of the crate) ... so that's great :) (updated the commit message to link this CommonMark example) |
504d325
to
70705df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks like there's a small conflict to resolve before merge though.
Previously the start page of the documentation on docs.rs for chumsky linked the examples and tutorial from the main branch, no matter which version you selected on docs.rs. So e.g. https://docs.rs/chumsky/0.9.2/chumsky/ links https://github.com/zesterer/chumsky/blob/main/examples/brainfuck.rs which is confusing since the main branch currently contains the source code for the upcoming 1.0.0, which has a different API. This commit remedies this for future releases by separating the link labels and URLs using CommonMark link reference definitions and overriding[1] them in src/lib.rs, building the correct URLs via CARGO_PKG_VERSION[2]. This trick will require git tags to be created for all future versions (so e.g. if 0.9.3 will be released the commit will have to be tagged with "0.9.3"). [1]: https://spec.commonmark.org/0.30/#example-204 [2]: https://doc.rust-lang.org/cargo/reference/environment-variables.html
70705df
to
dfec5ff
Compare
Thanks! |
Previously the start page of the documentation on docs.rs for chumsky linked the examples and tutorial from the main branch, no matter which version you selected on docs.rs.
So e.g. https://docs.rs/chumsky/0.9.2/chumsky/ links https://github.com/zesterer/chumsky/blob/main/examples/brainfuck.rs which is confusing since the main branch currently contains the source code for the upcoming 1.0.0, which has a different API.
This commit remedies this for future releases by separating the link labels and URLs using CommonMark link reference definitions1 and overriding them in src/lib.rs, building the correct URLs via CARGO_PKG_VERSION2.
This trick will require git tags to be created for all future versions (so e.g. if 0.9.3 will be released the commit will have to be tagged with "0.9.3").