Allow loading examples from GitHub #181
Closed
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.
Resolves #164. This commit implements loading module content from GitHub simply by taking a
github
query 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.purs
would load the fileclient/examples/Main.purs
from themaster
branch 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/examples
but before I go ahead and do that I'd like to just check that the approach seems reasonable.