Added support for git file versions in snippets #27
Open
loarabia wants to merge 1 commit intocreationix:masterfrom
Open
Added support for git file versions in snippets #27loarabia wants to merge 1 commit intocreationix:masterfrom
loarabia wants to merge 1 commit intocreationix:masterfrom
Conversation
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! CONTEXT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Wheat currently supports snippets that are demarcated by a newline < > newline. Inside of the snippet's brackets, you can specify the relative path from one of Wheat's markdown articles to a code snippet. In addition to that, wheat can handle those snippets in different ways. A snippet ending in a *, for example foo/bar.baz*. Will be executed and the result shown beneath the snippet in final rendering. A snippet ending in a #label will look inside the snippet file for a comment and display from that #forward. For instance, foo/bar.baz#doAwesomeStuff will look for: //doAwesomeStuff doSomethingAwesome(); //doSomethingLessAwesome doLesserThings(); and diaplay just the doSomethingAwesome. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! CHANGE MOTIVIATION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! This change proposes the addition of an additional syntax, :SHA which will get a specific version of a file in Wheat's git repository. One would want this when building out a demo application step by step. If you make a project directory under articles and commit to it piece by piece, it is very natural as a developer. On the other hand, right now when using Wheat, a developer often makes multiple copies of the same file for instance app.js, app2.js, app-final.js to use as snippets during different stages of the article. If you're not careful, this can get confusing (speaking from experience here using Wheat) especially if you go to update an article you wrote a while back. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! CHANGE USAGE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! With this change, you can use the below as the content of a snippet: foo/bar.baz:aaaaabbbbbcccccdddddeeeeefffff1111100040 and foo/bar.baz:ffffffffffffffffffffffffffffffffff00040 and get different versions of the same file from git. When using this feature, you must specify the full 40 character git SHA and it does not work with # (although it does work with *) -- the theory being do the smallest change possible.
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.
CONTEXT
Wheat currently supports snippets that are demarcated by a newline < > newline.
Inside of the snippet's brackets, you can specify the relative path from one of
Wheat's markdown articles to a code snippet. In addition to that, wheat can
handle those snippets in different ways.
A snippet ending in a , for example foo/bar.baz. Will be executed and the
result shown beneath the snippet in final rendering.
A snippet ending in a #label will look inside the snippet file for a comment
and display from that #forward.
For instance, foo/bar.baz#doAwesomeStuff will look for:
//doAwesomeStuff
doSomethingAwesome();
//doSomethingLessAwesome
doLesserThings();
and diaplay just the doSomethingAwesome.
CHANGE MOTIVIATION
This change proposes the addition of an additional syntax, :SHA which will
get a specific version of a file in Wheat's git repository.
One would want this when building out a demo application step by step. If you
make a project directory under articles and commit to it piece by piece, it is
very natural as a developer.
On the other hand, right now when using Wheat, a developer often makes multiple
copies of the same file for instance app.js, app2.js, app-final.js to use as
snippets during different stages of the article. If you're not careful, this
can get confusing (speaking from experience here using Wheat) especially if
you go to update an article you wrote a while back.
CHANGE USAGE
With this change, you can use the below as the content of a snippet:
foo/bar.baz:aaaaabbbbbcccccdddddeeeeefffff1111100040
and
foo/bar.baz:ffffffffffffffffffffffffffffffffff00040
and get different versions of the same file from git.
When using this feature, you must specify the full 40 character git SHA and it
does not work with # (although it does work with *) -- the theory being do the
smallest change possible.