diff options
author | zwbetz-gh <zwbetz@gmail.com> | 2020-08-05 05:25:42 +0300 |
---|---|---|
committer | zwbetz-gh <zwbetz@gmail.com> | 2020-08-05 05:25:42 +0300 |
commit | 72bb0d7e7e3e623e2f751f3a9375ca6df4ed210f (patch) | |
tree | 20075ebc11c5a64db2f405f97a969f7a6963de95 | |
parent | b4d6db179a2a959ae1bf8c23b8ed7f624734084a (diff) |
do #42
-rw-r--r-- | assets/css/template-styles.css | 2 | ||||
-rw-r--r-- | exampleSite/content/post/cmd-test.md | 13 | ||||
-rw-r--r-- | layouts/shortcodes/cmd.html | 8 |
3 files changed, 21 insertions, 2 deletions
diff --git a/assets/css/template-styles.css b/assets/css/template-styles.css index a4bb338..9ce3042 100644 --- a/assets/css/template-styles.css +++ b/assets/css/template-styles.css @@ -161,7 +161,7 @@ code { } .cmd code { color: #fefefe; - white-space: nowrap; + white-space: pre-wrap; } .cmd code::before { content: '$'; diff --git a/exampleSite/content/post/cmd-test.md b/exampleSite/content/post/cmd-test.md new file mode 100644 index 0000000..55c1569 --- /dev/null +++ b/exampleSite/content/post/cmd-test.md @@ -0,0 +1,13 @@ +--- +title: "cmd Test" +date: 2020-08-04T21:05:05-05:00 +tags: [issue] +--- + +Testing out GitHub issue https://github.com/zwbetz-gh/cupper-hugo-theme/issues/42 + +{{< cmd >}} +Line 1 +Line 2 +Line 3 +{{</ cmd >}} diff --git a/layouts/shortcodes/cmd.html b/layouts/shortcodes/cmd.html index cd21bc1..ccadc07 100644 --- a/layouts/shortcodes/cmd.html +++ b/layouts/shortcodes/cmd.html @@ -1 +1,7 @@ -<pre class="cmd"><code>{{ trim .Inner "\n" }}</code></pre> +{{ $trimmed := (trim .Inner "\n") }} +{{ $lines := split $trimmed "\n" }} +<pre class="cmd"> + {{ range $lines }} + <code>{{ . }}</code> + {{ end }} +</pre> |