Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

docs: wrap command-only terminal blocks; fix blank-line prompts (#3126)

Maximilian Roos063e3da50d93
diff --git a/docs/sass/custom.scss b/docs/sass/custom.scss
index a8919cc42..d923a0e3d 100644
--- a/docs/sass/custom.scss
+++ b/docs/sass/custom.scss
@@ -574,6 +574,14 @@ main {
}
}
+// Command-only terminals (recipe lists with no fixed-width output) wrap long
+// pipelines at spaces instead of scrolling them out of view; a single
+// unbreakable token still falls back to the inherited horizontal scroll.
+// Fixed-width output (tables, ASCII art) keeps the default no-wrap.
+.terminal--commands code {
+ white-space: pre-wrap;
+}
+
// ============================================================================
// Blockquotes / Callouts
// ============================================================================
diff --git a/docs/templates/shortcodes/terminal.html b/docs/templates/shortcodes/terminal.html
index c43bd02bc..f769b625b 100644
--- a/docs/templates/shortcodes/terminal.html
+++ b/docs/templates/shortcodes/terminal.html
@@ -3,12 +3,18 @@
{% set cmd_lines = cmd | split(pat="|||") %}
{% if body is defined %}
{% set clean_body = body | regex_replace(pattern='<span class="cmd">[^<]*</span>\n?', rep="") %}
+{% set extra_class = "" %}
{% else %}
{% set clean_body = "" %}
+{% set extra_class = " terminal--commands" %}
{% endif %}
-<pre class="terminal"><code>
+<pre class="terminal{{ extra_class }}"><code>
{%- for cmd_line in cmd_lines -%}
{%- set cmd_line = cmd_line | replace(from="__WT_OPEN__", to="{{") | replace(from="__WT_CLOSE__", to="}}") | replace(from="__WT_QUOT__", to='"') -%}
+{%- if cmd_line | trim == "" -%}
+{{ "
+" }}
+{%- else -%}
{%- set md = fence ~ "bash
" ~ cmd_line ~ "
" ~ fence -%}
@@ -19,6 +25,7 @@
{% else -%}
<span class="cmd">{{ hl | safe }}</span>
{% endif -%}
+{%- endif -%}
{%- endfor -%}
{{ clean_body | safe }}</code></pre>
{% else %}