tui(mermaid): ensure blank line between adjacent mermaid blocks

- After wrapping unfenced diagrams, always insert a separator line
- Prevent back-to-back fenced blocks that can break rendering in marked/mermaid
This commit is contained in:
kh.ai
2025-10-23 12:42:37 -07:00
parent dcf5489659
commit ae5150c37a
2 changed files with 17 additions and 11 deletions

View File

@@ -630,9 +630,15 @@ pub(crate) fn fix_mermaid_blocks(input: &str) -> String {
let block = lines[start..end].join("\n");
out_lines.push(lint_and_wrap(block.trim_matches('\n')));
idx = end;
if idx < lines.len() && lines[idx].trim().is_empty() {
out_lines.push(lines[idx].clone());
idx += 1;
// Always add a blank line separator after a mermaid block to avoid
// back-to-back fenced blocks which some renderers mishandle.
if idx < lines.len() {
if lines[idx].trim().is_empty() {
out_lines.push(lines[idx].clone());
idx += 1;
} else {
out_lines.push(String::new());
}
}
continue;
}

View File

@@ -1175,11 +1175,10 @@ fn render_bug_sections(snapshots: &[BugSnapshot], git_link_info: Option<&GitLink
let lower = composed.to_ascii_lowercase();
let has_assignee =
lower.contains("assignee:") || lower.contains("author:") || lower.contains("owner:");
if !has_assignee
&& let Some(handle) = snapshot.bug.assignee_github.as_ref() {
let line = format!("\n\nAssignee: {handle}\n");
composed.push_str(&line);
}
if !has_assignee && let Some(handle) = snapshot.bug.assignee_github.as_ref() {
let line = format!("\n\nAssignee: {handle}\n");
composed.push_str(&line);
}
if !matches!(snapshot.bug.validation.status, BugValidationStatus::Pending) {
composed.push_str("\n\n#### Validation\n");
let status_label = validation_status_label(&snapshot.bug.validation);
@@ -6567,9 +6566,10 @@ async fn enrich_bug_summaries_with_blame(
};
// Try to derive a GitHub handle from the author-mail if it uses the noreply pattern.
if let Some(mail) = author_mail.as_ref()
&& let Some(handle) = github_handle_from_email(mail) {
summary.author_github = Some(handle);
}
&& let Some(handle) = github_handle_from_email(mail)
{
summary.author_github = Some(handle);
}
summary.blame = Some(format!("{short_sha} {author_name} {date} {range_display}"));
logs.push(format!(
"Git blame for bug #{id}: {short_sha} {author_name} {date} {range}",