Allow loading examples from GitHub#181
Conversation
|
I've verified that this works locally by replacing the mainGithubExample :: String
mainGithubExample = "hdgarrood/trypurescript/load-from-github/client/examples/Main.purs" |
|
Nice! |
|
I don't have a solution for this, and maybe I'm just not thinking about it enough, but is it possible to have both content and examples in the same repo, linking to runnable examples from the content and still have both part of a single tag? I know that sounds a little convoluted, but is there a way to use this without always linking to a fixed branch (be it |
|
One solution is if you have a publication system, it could potentially rewrite links. |
|
I'm not sure I follow. Eventually you'll always have to specify a branch or a tag, right? Are you thinking that it might be awkward to work on documentation guides in other repositories with this design because you might want to point to a tag that doesn't exist yet? |
|
Closed in #218 |
Resolves #164. This commit implements loading module content from GitHub simply by taking a
githubquery string parameter, if present, and tacking that string onto the end ofhttps://raw.githubusercontent.com/in order to fetch a PureScript source file from somewhere on GitHub. So for exampletry.purescript.org/?github=purescript/trypurescript/master/client/examples/Main.purswould load the fileclient/examples/Main.pursfrom themasterbranch in this repo.I'm hoping that by doing it this way, we will make it easier not only for us to maintain examples, but also for people writing documentation for other projects to create and maintain examples that they can link to and collaborate on, since collaborating on GitHub is much easier than collaborating on Gists.
This is a bit rough at the moment, and I've only added the main example in here, which is why I've marked the pull request as draft. I think at least the following needs to happen before this is mergeable:
client/examplesbut before I go ahead and do that I'd like to just check that the approach seems reasonable.