diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-03-21 22:17:07 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-03-21 22:17:07 +0300 |
commit | ce059fee0df97efcfb30b173ee6d8aa7a8d43ecd (patch) | |
tree | 4621b325cffc82c40723cd5eee4f3400674436b4 /_includes | |
parent | color badges green (diff) | |
download | jekyll-theme-ce059fee0df97efcfb30b173ee6d8aa7a8d43ecd.tar.gz jekyll-theme-ce059fee0df97efcfb30b173ee6d8aa7a8d43ecd.zip |
add an include for shell commands & output
Diffstat (limited to '_includes')
-rw-r--r-- | _includes/shell.html | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/_includes/shell.html b/_includes/shell.html new file mode 100644 index 0000000..40ed1c8 --- /dev/null +++ b/_includes/shell.html @@ -0,0 +1,22 @@ +<div class="shell"> +{% assign cmd = include.cmd | newline_to_br | strip_newlines %} +{% assign br = '<br />' %} +{% assign br_len = br | size %} +{% assign prefix = cmd | slice: 0,br_len %} +{% if prefix == br %} + {% assign cmd = cmd | remove_first: br %} +{% endif %} +{% assign cmd = cmd | split: br %} +{% assign new_cmd = '' | split: '' %} +{% for line in cmd %} + {% capture new_line %}{{ line }} +{% endcapture %} + {% assign new_cmd = new_cmd | push: new_line %} +{% endfor %} +{% assign cmd = new_cmd %} +{% assign cmd = cmd | join: '' %} +<div> + <pre class="shell-mark">$</pre><pre class="shell-cmd">{{ cmd }}</pre> +</div> +<pre class="shell-out">{{ include.out }}</pre> +</div> |