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

git integration #14

Open
kianenigma opened this issue Oct 16, 2023 · 8 comments
Open

git integration #14

kianenigma opened this issue Oct 16, 2023 · 8 comments

Comments

@kianenigma
Copy link

end goal:

#[doc = docify::embed!(git: "github.com/paritytech/polkadot-sdk.git", path: "substrate/frame/examples/basic/src/lib.rs", item: my_cool_item)]
@sam0x17
Copy link
Owner

sam0x17 commented Oct 19, 2023

another thing I'm contemplating here is being able to specify at the crate level a fallback git url to use for relative paths, so at the beginning of lib.rs you could specify something like:

docify::set_git_fallback!(git: "github.com/paritytech/polkadot-sdk.git", base_path: "path/to/current/crate");

And then any embeds that fail, it will use that git repo and path as the fallback and will try to find things from within there. So this way you could still use your relative paths and they will work normally 99% of the time, and then in that weird scenario where they don't work because of cargo publish shenanigans, it will use this fallback.

But the basic git feature is also something I want to do anyway because there are some scenarios where that is the only way to do something

@kianenigma
Copy link
Author

IF and when you would use git, it would be cool if you could enable in option that would also put a permalink to the line of code as a comment in the first line of the snippet. So you would see the code, then you could also click on this link and see it in the original context.

@sam0x17
Copy link
Owner

sam0x17 commented Oct 20, 2023

yeah was thinking about having something like a shields.io button to the permalink or something but yeah this is also in my mental scaffold for this

@sam0x17
Copy link
Owner

sam0x17 commented Oct 22, 2024

one key thing when implementing this: need to make sure to use some sort of crate that provides git cloning, since it is likely that the git cli is not available on the crates.io runners

@kianenigma
Copy link
Author

one key thing when implementing this: need to make sure to use some sort of crate that provides git cloning, since it is likely that the git cli is not available on the crates.io runners

How about just raw GET requests to raw.githubuserconent.com and so on and so forth?

@sam0x17
Copy link
Owner

sam0x17 commented Oct 23, 2024

one key thing when implementing this: need to make sure to use some sort of crate that provides git cloning, since it is likely that the git cli is not available on the crates.io runners

How about just raw GET requests to raw.githubuserconent.com and so on and so forth?

could, but would be better to operate at the git level i.e. for people who use non-github git hosting

@kianenigma
Copy link
Author

Let's see if there is an option. If not, I think gh-only is a reasonable compromise.

@sam0x17
Copy link
Owner

sam0x17 commented Oct 24, 2024

yeah looking into it

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