Skip to content

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

Fix inline code rendering within bold text

Maximilian Roos2313fc78336d
diff --git a/src/md_help.rs b/src/md_help.rs
index e6b2b024d..3f4760343 100644
--- a/src/md_help.rs
+++ b/src/md_help.rs
@@ -281,7 +281,9 @@ fn render_inline_formatting(line: &str) -> String {
}
bold_content.push(c);
}
- result.push_str(&format!("{bold}{bold_content}{bold:#}"));
+ // Recursively process inline formatting within bold content
+ let processed_content = render_inline_formatting(&bold_content);
+ result.push_str(&format!("{bold}{processed_content}{bold:#}"));
} else {
result.push(ch);
}
@@ -636,6 +638,16 @@ mod tests {
assert!(result.contains("\u{1b}[1m")); // Bold
}
+ #[test]
+ fn test_render_inline_formatting_bold_with_code() {
+ // Nested formatting: **`wt list`:** should render code inside bold
+ let result = render_inline_formatting("**`wt list`:**");
+ assert!(result.contains("wt list"));
+ assert!(result.contains("\u{1b}[1m")); // Bold
+ assert!(result.contains("\u{1b}[2m")); // Dimmed (for code)
+ assert!(!result.contains('`')); // Backticks should be consumed
+ }
+
#[test]
fn test_render_inline_formatting_mixed() {
let result = render_inline_formatting("text `code` more **bold** end");
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_long.snap b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
index d1421f488..ac8631caf 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
@@ -106,7 +106,7 @@ Controls where new worktrees are created. The template is relative to the reposi
Set persistent flag values for commands. These apply unless explicitly overridden on the command line.
-`wt list`:
+wt list:
[list]
# All off by default
@@ -114,12 +114,12 @@ Set persistent flag values for commands. These apply unless explicitly overridde
branches = true # --branches
remotes = true # --remotes
-`wt step commit` and `wt merge` staging:
+wt step commit and wt merge staging:
[commit]
stage = "all" # "all" (default), "tracked", or "none"
-`wt merge`:
+wt merge:
[merge]
# These flags are on by default; set to false to disable