Skip to content

Commit

Permalink
Render commit messages with markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsgrd committed Feb 21, 2025
1 parent 7ceff72 commit 9a1236b
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"postcss-nesting": "^12.1.5",
"postcss-pxtorem": "^6.1.0",
"posthog-js": "1.136.4",
"marked": "catalog:",
"reflect-metadata": "^0.2.2",
"svelte": "catalog:svelte",
"svelte-check": "catalog:svelte",
Expand Down
3 changes: 2 additions & 1 deletion apps/desktop/src/components/CommitCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import PopoverActionsContainer from '@gitbutler/ui/popoverActions/PopoverActionsContainer.svelte';
import PopoverActionsItem from '@gitbutler/ui/popoverActions/PopoverActionsItem.svelte';
import { getTimeAgo } from '@gitbutler/ui/utils/timeAgo';
import { marked } from 'marked';
import { type Snippet } from 'svelte';
const userService = getContext(UserService);
Expand Down Expand Up @@ -377,7 +378,7 @@
<div class="commit__details">
{#if commit.descriptionBody}
<span class="commit__description text-12 text-body">
{commit.descriptionBody}
{@html marked(commit.descriptionBody)}
</span>
{/if}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import Modal from '@gitbutler/ui/Modal.svelte';
import Tooltip from '@gitbutler/ui/Tooltip.svelte';
import { getTimeAgo } from '@gitbutler/ui/utils/timeAgo';
import { marked } from 'marked';
import type { Commit, WorkspaceBranch } from '$lib/branches/v3';
interface Props {
Expand Down Expand Up @@ -68,7 +69,7 @@
</script>

<div class="wrapper">
<div class="message text-12">{commitMessage}</div>
<div class="message text-12">{@html marked(commitMessage)}</div>
<div class="metadata text-11 text-semibold">
{#if commit.hasConflicts}
<Tooltip
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@types/tryghost__content-api": "^1.3.17",
"dayjs": "^1.11.13",
"highlight.js": "^11.10.0",
"marked": "^10.0.0",
"marked": "catalog:",
"satori": "^0.12.1",
"satori-html": "^0.3.2"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
// render markdowns
let markdowns = document.querySelectorAll('.markdown');
markdowns.forEach((markdown) => {
markdown.innerHTML = marked(markdown.innerHTML);
markdown.innerHTML = marked(markdown.innerHTML, { async: false });
});
}, 10);
});
Expand Down
3 changes: 1 addition & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,13 @@
"@terrazzo/parser": "0.6.0",
"@terrazzo/plugin-css": "0.6.0",
"@types/diff-match-patch": "^1.0.36",
"@types/marked": "^5.0.2",
"@types/postcss-pxtorem": "^6.1.0",
"@vitest/browser": "^3.0.3",
"autoprefixer": "^10.4.20",
"cpy-cli": "^5.0.0",
"dayjs": "^1.11.13",
"diff-match-patch": "^1.0.5",
"marked": "^10.0.0",
"marked": "catalog:",
"playwright": "1.47.0",
"postcss": "^8.4.49",
"postcss-cli": "^11.0.0",
Expand Down
28 changes: 13 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ catalog:
'vite': '6.1.0'
'vitest': '3.0.5'
'@vitest/ui': '3.0.5'
'marked': '15.0.7'
catalogs:
svelte:
'svelte': '5.19.7'
Expand Down

0 comments on commit 9a1236b

Please # to comment.