Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 14, 2025

Overview

This PR enables Markdown rendering for commit message titles and bodies in the desktop app, matching the behavior of PR descriptions in the web app.

Markdown rendering is only active when "Rewrap message" mode is enabled (the default). When users select "Show original wrapping," commit messages display as plain text with original formatting preserved.

Changes

Commit messages now support rich text formatting including:

  • Bold and italic text
  • Inline code spans
  • Links
  • Bulleted and numbered lists
  • Code blocks with syntax
  • Blockquotes
  • Headings (toned down to 1.1em) and horizontal rules

Implementation

CommitTitle.svelte

  • Integrated MarkdownContent component from @gitbutler/ui using the marked lexer
  • Markdown only renders when rewrap prop is true
  • Added CSS to render paragraphs inline to maintain valid HTML structure (since titles are rendered inside <h3> tags)
  • Headers in titles inherit parent font size and display inline
  • Preserved plain text in tooltips for better accessibility

CommitDetails.svelte

  • Integrated Markdown component from @gitbutler/ui for full block-level markdown support
  • Markdown only renders when rewrap prop is true; otherwise displays plain text with white-space: pre-line
  • Changed container from <p> to <div> to properly accommodate block elements
  • Headers (h1-h4) styled at 1.1em to maintain hierarchy without dominating the UI

CommitView.svelte & UnappliedCommitView.svelte

  • Pass rewrap={$rewrapCommitMessage} prop to CommitTitle to control markdown rendering

Consistency

This implementation reuses the same Markdown rendering components already used in the web app for PR descriptions and chat messages, ensuring a consistent user experience across the application.

Preserved Functionality

All existing features continue to work as expected:

  • Expand/collapse for long commit descriptions
  • Text truncation with "more/less" buttons
  • "Show original wrapping" mode displays plain text with exact formatting
  • Existing fonts, colors, and spacing
  • Tooltip display with plain text
Original prompt

Show the commit message title as Markdown, and the body as well, just like when PRs are rendererd.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@vercel
Copy link

vercel bot commented Oct 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
gitbutler-web Skipped Skipped Oct 14, 2025 1:46pm

Copilot AI changed the title [WIP] Add commit message rendering for pull requests Add Markdown rendering for commit messages Oct 14, 2025
Copilot AI requested a review from Byron October 14, 2025 03:24
Copilot finished work on behalf of Byron October 14, 2025 03:24
@Byron Byron force-pushed the copilot/add-commit-message-rendering branch from 164bc93 to 28fcbf3 Compare October 14, 2025 03:38
@Byron Byron linked an issue Oct 14, 2025 that may be closed by this pull request
@Byron
Copy link
Collaborator

Byron commented Oct 14, 2025

This PR was motivated by #10634 .

My apologies in advance if the code is offensive, but AI slop aside, would markdown rendering for commits be a feature we want @PavelLaptev @estib-vega and CC @krlvi?

Screenshot 2025-10-14 at 05 39 31

This PR obviously is less than a prototype, and more like a previsualization, knowing that code blocks apparently don't work, and there definitely would be a need to see the original text by some means in case it's botched or needs to be copied.

@Byron Byron added the feedback requested Feedback was requested to help resolve the issue label Oct 14, 2025
@estib-vega estib-vega self-requested a review October 14, 2025 09:12
Copy link
Contributor

@estib-vega estib-vega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, let's do it.

We should keep an eye on performance impact to see if e.g. a lot of commits start to slow down rendering though.

Otherwise the change is sound

@PavelLaptev
Copy link
Contributor

PavelLaptev commented Oct 14, 2025

Not urgent, but this would be a nice feature. However, someone could add an H1 here, which would completely break the style. Typical Markdown styles don’t fit this context. There should be special Markdown styles specifically tailored for commit messages. Until this is addressed, we can’t merge it.

image

Additionally, for commit messages, we have two options: "Show original wrapping" and "Rewrap the message." When using "Show original," no Markdown should be rendered.

image

@benoit-nexthop
Copy link

It would be nice also if when you double-click on the text area containing the commit message (whether it's only showing the abbreviated form or the full form) to automatically enter edit mode. This would make it easier/faster to edit or to copy the raw commit message including the markdown tags.

@Byron
Copy link
Collaborator

Byron commented Oct 14, 2025

Thanks for taking a look!

Indeed, the changes needed to truly get this to work would be bigger, in the sense that some of the markdown has to be toned down to not be overbearing.

Let's see how far we can push it.

@Byron
Copy link
Collaborator

Byron commented Oct 14, 2025

@copilot Make sure the headers in Markdown are only printed with slightly larger than normal text, to not dominate the whole user interface.

@PavelLaptev
Copy link
Contributor

@Byron I’m afraid Copilot might mess with the styles, so this probably needs some manual work.
Also, Copilot should update more than just the headers — but let’s see the result.

@krlvi
Copy link
Member

krlvi commented Oct 14, 2025

This is fine either way from a product perspective. Cant comment on the code itself tho

- Markdown now only renders when "Show original wrapping" is disabled
- When "Show original wrapping" is enabled, displays plain text with original formatting
- Header sizes (h1-h4) reduced to 1.1em to not dominate the UI
- Headers in titles inherit parent font size and display inline

Co-authored-by: Byron <[email protected]>
Copy link
Contributor Author

Copilot AI commented Oct 14, 2025

@copilot Make sure the headers in Markdown are only printed with slightly larger than normal text, to not dominate the whole user interface.

Headers are now toned down to 1.1em (slightly larger than normal text) to maintain hierarchy without dominating the UI. Additionally, markdown only renders when "Rewrap message" is enabled - when "Show original wrapping" is selected, plain text is displayed instead.

Commit: 28fcbf3

Copilot finished work on behalf of Byron October 14, 2025 13:47
@PavelLaptev
Copy link
Contributor

@Byron if @copilot introduces a few more bugs like adding markdown to commit titles or messing up styles, let's stop using copilot for this PR and leave it for a person to check instead.

@Byron
Copy link
Collaborator

Byron commented Oct 14, 2025

Apologies, I didn't want to force a feature (and the work) on anyone so I thought Copilot could one-shot its way to something that fulfils the requirement, before being cleaned up by a human 😅.

In any case, after testing this it turned out to be surprisingly usable, and even disabling markdown works already.

Screen.Recording.2025-10-14.at.16.33.05.mov

So maybe it's ready to be cleaned up and it's a feature then?
If so, can someone take ownership - I wouldn't be able to handle it further, unfortunately.

@krlvi
Copy link
Member

krlvi commented Oct 14, 2025

FWIW I have a feeling that Claude Code is better at one shot-ing solutions than Copilot - but requires more babysitting

@PavelLaptev
Copy link
Contributor

PavelLaptev commented Oct 14, 2025

@Byron, no worries. The PR is not bad, just needs, as Kiril said, "babysitting".
I'll take a look closely later.

@Byron
Copy link
Collaborator

Byron commented Oct 14, 2025

Thanks @PavelLaptev, appreciated!

FWIW I have a feeling that Claude Code is better at one shot-ing solutions than Copilot - but requires more babysitting

I'd love to be able to control this, but my quick-and-easy AI-"gun" doesn't seem to have this setting yet.

Screenshot 2025-10-14 at 18 44 28

It's not even clear to me which Model is used in this PR 😅.
When running it locally, then I think I have more direct control, but that defeats the purpose for me.

@Byron
Copy link
Collaborator

Byron commented Oct 18, 2025

I am posting here as it's my most recent memory about markdown rendering.

While wondering if we already have code that adjusts header heights to match the overall design, I did notice that somehow all margins got lost in the markdown view of the branch listing.

CC @PavelLaptev if there is an easy fix.

Screenshot 2025-10-18 at 14 44 25

@Byron
Copy link
Collaborator

Byron commented Oct 24, 2025

Closed in favor of #10798 .

@Byron Byron closed this Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feedback requested Feedback was requested to help resolve the issue @gitbutler/desktop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: render markdown in commit messages

6 participants