-
Notifications
You must be signed in to change notification settings - Fork 11
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
add syntax for using existing snippet as input #57
Comments
Can you give me a more concrete example of the use case? I'm having trouble figuring out how it would work in practice. |
Sure. The following is an example that instructs the reader to install a program. The goal is to point to a concrete release, but keep the release number up to date. Example 1: Download the latest CLI from our release and put it into your PATH:
curl -fLO https://github.com/errata-ai/vale-action/releases/download/v2.1.0/vale
mv vale /usr/local/bin/vale However, to my current understanding, the template must currently be places in the inline shell code, which makes Example 1 quite repetitive. Let's say we introduce a new inline shell operator Example 2: Download the latest CLI from our release and put it into your PATH:
curl -fLO https://github.com/errata-ai/vale-action/releases/download/v2.1.0/vale
mv vale /usr/local/bin/vale The two lines in the code fence of Example 2 are put into the stdin of sed, so sed can just work on the content of the code block that already exists. Might be even clearer with the following, using Example 3:
Now matter how often you run mdsh on Example 3, the text will always stay the same, as we put the text into stdin of |
As far as I understand mdsh, it is currently used to (re-)generate markdown snippets. It would be nice if a command could update an existing snippet, so we don't have to generate the entire thing in code but rather modify the tiny bit we are interested in.
This could be implemented by injecting the target block as stdin:
& sed -e 's/foo/bar/'
Run mdsh.
foo
is fed as stdin to sed. Result:& sed -e 's/foo/bar/'
This could for example be used to update things like versions in more complex markdown blocks.
The text was updated successfully, but these errors were encountered: