Skip to content

Commit e279512

Browse files
committed
feat: render code blocks in issue titles
1 parent ecc4993 commit e279512

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/web/src/components/IssueCard.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,22 @@ function IssueTitleWithLabels({ issue }: { issue: Issue }) {
140140
);
141141
};
142142

143+
const processTitle = (title: string) => {
144+
return title.replace(/`([^`]+)`/g, "<code>$1</code>");
145+
};
146+
143147
return (
144148
<div className="min-w-0 grow text-lg font-semibold">
145149
<a
146150
href={issue.issueUrl}
147151
target="_blank"
148152
rel="noopener noreferrer"
149-
className="text-foreground hover:text-primary"
153+
className="text-foreground hover:text-primary [&_code]:rounded [&_code]:bg-muted [&_code]:px-1.5 [&_code]:py-0.5"
150154
>
151-
<span className="[word-break:break-word]">{issue.title}</span>
155+
<span
156+
className="[word-break:break-word]"
157+
dangerouslySetInnerHTML={{ __html: processTitle(issue.title) }}
158+
/>
152159
</a>
153160
{issue.labels && issue.labels.length > 0 && (
154161
<span className="ml-2 inline-flex gap-2">

0 commit comments

Comments
 (0)