Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .config/jp/tools/src/ticket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ fn show(root: &Utf8Path, id: TicketId) -> ToolResult {
};

match entry.ticket {
Ok(ticket) => Ok(render_ticket(entry.id, &ticket, &relative(root, &entry.path)).into()),
Ok(ticket) => {
let rendered = render_ticket(entry.id, &ticket, &relative(root, &entry.path));
// The terminal keys syntax highlighting off a leading code fence,
// so the fence is what gets a ticket displayed as markdown rather
// than as a flat wall of text.
Ok(format!("```markdown\n{}\n```", rendered.trim_end()).into())
}
Err(problem) => error(format!("{id} is not a well-formed ticket: {problem}")),
}
}
Expand Down
7 changes: 6 additions & 1 deletion .config/jp/tools/src/ticket_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,15 @@ fn show_renders_metadata_and_the_description() {
json!({ "id": id.to_string() }),
));

// Fenced as markdown: the terminal renderer keys syntax highlighting off
// the leading fence.
assert!(
out.starts_with(&format!("# {id}: Tool call header misaligned\n")),
out.starts_with(&format!(
"```markdown\n# {id}: Tool call header misaligned\n"
)),
"{out}"
);
assert!(out.ends_with("\n```"), "{out}");
assert!(
out.contains(&format!(
"- **Path**: docs/ticket/{}tool-call-header-misaligned.md",
Expand Down
Loading