Skip to content

Fix syntax highlighting, LaTeX rendering, and various other UI fixes - #166

Merged
Avni2000 merged 13 commits into
mainfrom
ui-fixes
Mar 14, 2026
Merged

Avni2000 merged 13 commits into
mainfrom
ui-fixes

Conversation

@Avni2000

@Avni2000 Avni2000 commented Mar 14, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Three-column conflict resolution UI with persistent action bar, side-by-side editors, and overwrite-confirmation modal.
    • Markdown rendering pipeline updated (affects how math/Markdown content is rendered and edited).
  • Style

    • Editor visuals switched to GitHub-themed CodeMirror and updated syntax highlighting.
    • Refreshed dark theme, layout refinements, and unified typography via Google-hosted fonts.
  • Chore

    • Font preloading/CSP updated to support the new font delivery.

@coderabbitai

coderabbitai Bot commented Mar 14, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Replaces custom CodeMirror theme with GitHub themes, removes local font copying and switches to Google Fonts, migrates Markdown rendering from renderMime/KaTeX to renderMarkdown, restructures merge UI into a three-column diff with action bar, and narrows MergeRow typing to a discriminated union.

Changes

Cohort / File(s) Summary
Build & Dependencies
esbuild.js, package.json, src/web/webServer.ts
Removed copyWebFonts helper and its invocation; added runtime dependency @uiw/codemirror-theme-github; updated CSP and HTML shell to allow and preload Google Fonts (fonts.googleapis.com, fonts.gstatic.com).
Editor Theme Removal
src/web/client/editorTheme.ts
Deleted the custom editor theme module and its exports (createMergeNBTheme, mergeNBEditorStructure, mergeNBSyntaxClassHighlighter).
CellContent / Markdown Rendering
src/web/client/CellContent.tsx
Replaced renderMime/KaTeX pipeline with renderMarkdown-based rendering; removed renderMime-specific options; added and exported CodeMirror extensions (mergeNBEditorStructure, mergeNBSyntaxClassHighlighter) and switched to GitHub CM themes.
Merge UI / Diff Layout
src/web/client/MergeRow.tsx
Reworked merge row into a three-column base/current/incoming diff layout; added persistent conflict-action-bar (reorder/unmatch/rematch/delete), cell_type-aware editor extension selection, pendingChoice edit-confirmation flow, and switched to GitHub CM themes and new extensions.
Styling & Typography
src/web/client/styles.ts
Removed local @font-face blocks, switched to Google Fonts import, introduced CSS variables (--font-ui, --font-code) and VSCode-like color tokens, and added styles for conflict-action-bar and multi-column diff layout.
Types & Cloning
src/web/client/types.ts, src/web/client/resolverStore.ts
Changed MergeRow to a discriminated union (isUserUnmatched true/false) altering presence of unmatchGroupId/originalMatchedRow; updated cloneRows to preserve originalMatchedRow only for user-unmatched rows.
Minor build/runtime edits
(implicit)
Small removals and API surface adjustments related to removed theme module and markdown/typesetter plumbing.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

Poem

🐇
I swapped the fonts and donned a theme,
Three columns hum where conflicts gleam.
Markdown hops with cleaner light,
GitHub colors through the night.
A little rabbit claps — delight.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title mentions 'syntax highlighting, LaTeX rendering, and various other UI fixes', but the actual changes show comprehensive refactoring of CodeMirror theming, removal of the LaTeX-related copyWebFonts helper, switching to GitHub themes, and restructuring the merge conflict UI. The title is partially related but understates the scope of substantial changes to theme architecture and conflict resolution UI, and doesn't capture the primary objective of the refactoring.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ui-fixes
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/web/client/styles.ts (1)

85-93: Consider font loading strategy to prevent FOUC.

Using @import for Google Fonts in a dynamically injected stylesheet may cause a Flash of Unstyled Content (FOUC). The fonts load asynchronously after the stylesheet is parsed. Consider:

  1. Adding font-display: swap in the Google Fonts URL (&display=swap is already present - good)
  2. Preloading critical fonts via <link rel="preload"> in the HTML shell

The current implementation is functional, and display=swap mitigates the worst FOUC effects.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/web/client/styles.ts` around lines 85 - 93, The injected `@import` URL in
the stylesheet (the Google Fonts line) can cause FOUC when loaded dynamically;
instead, add explicit <link rel="preload"> entries for the critical fonts in the
HTML shell (preload the Inter and JetBrains Mono font files with as="font", the
correct type, and crossorigin) and keep the current &display=swap fallback on
the `@import`; leave the :root variables (--font-ui and --font-code) as-is so they
use the preloaded fonts when ready and keep the `@import` only as a non-blocking
fallback if needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/web/client/MergeRow.tsx`:
- Around line 271-283: The code uses row.isUserUnmatched && row.unmatchGroupId
but the types allow them independently, hence the non-null assertion
row.unmatchGroupId! in MergeRow.tsx; fix by changing the row type to a
discriminated union so that when isUserUnmatched: true the shape includes
unmatchGroupId: string (and when false it omits or makes it undefined), update
the Row type definition (the same type used by resolverStore and MergeRow) to
reflect this invariant, then remove the non-null assertion in MergeRow and let
TypeScript narrow row to the variant where unmatchGroupId is guaranteed when
used with row.isUserUnmatched and onRematchRows.

In `@src/web/client/styles.ts`:
- Line 1322: In src/web/client/styles.ts there is a CSS declaration "border: 1px
solid var(--border-color);;" with a duplicate semicolon; edit the relevant style
rule to remove the extra semicolon so it becomes a single semicolon after the
declaration (look for the border property usage in the same CSS rule in
styles.ts to locate it).
- Line 1278: Remove the duplicate semicolon at the end of the CSS rule "border:
1px solid var(--border-color);;" — locate the stylesheet/template containing
that rule in src/web/client/styles.ts and change it to a single semicolon
("border: 1px solid var(--border-color);") so the CSS is valid.

---

Nitpick comments:
In `@src/web/client/styles.ts`:
- Around line 85-93: The injected `@import` URL in the stylesheet (the Google
Fonts line) can cause FOUC when loaded dynamically; instead, add explicit <link
rel="preload"> entries for the critical fonts in the HTML shell (preload the
Inter and JetBrains Mono font files with as="font", the correct type, and
crossorigin) and keep the current &display=swap fallback on the `@import`; leave
the :root variables (--font-ui and --font-code) as-is so they use the preloaded
fonts when ready and keep the `@import` only as a non-blocking fallback if needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 53f600b6-8846-4276-a1cb-149564dbc181

📥 Commits

Reviewing files that changed from the base of the PR and between f142d8b and 3f800ec.

⛔ Files ignored due to path filters (3)
  • package-lock.json is excluded by !**/package-lock.json
  • src/web/client/fonts/dm-sans-700-latin.woff2 is excluded by !**/*.woff2
  • src/web/client/fonts/playfair-display-italic-500-latin.woff2 is excluded by !**/*.woff2
📒 Files selected for processing (7)
  • esbuild.js
  • package.json
  • src/web/client/CellContent.tsx
  • src/web/client/MergeRow.tsx
  • src/web/client/editorTheme.ts
  • src/web/client/styles.ts
  • src/web/webServer.ts
💤 Files with no reviewable changes (2)
  • src/web/client/editorTheme.ts
  • esbuild.js

Comment thread src/web/client/MergeRow.tsx Resolved
Comment thread src/web/client/styles.ts Resolved
Comment thread src/web/client/styles.ts Resolved
@Avni2000 Avni2000 changed the title Ui fixes Refactor CodeMirror theming and Markdown rendering pipeline Mar 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/web/client/MergeRow.tsx`:
- Around line 83-87: The current cellType is chosen from a fixed fallback order
(cellType = row.currentCell?.cell_type || row.incomingCell?.cell_type ||
row.baseCell?.cell_type || 'code') which causes the editorExtensions and
resolved editor to be wrong when the user switches branch selection; change the
logic to compute a resolvedCellType derived from the user's selected branch
choice (e.g., inspect the same selector/state used for the resolved editor — any
variable like selectedBranch/selectedSide) and use that resolvedCellType in the
useMemo that builds editorExtensions (replace cellType with resolvedCellType and
add that selector/state to the dependency array) so extensions/styling update
correctly when branch choice changes (update references to cellType,
editorExtensions, and the resolved editor code that relies on them).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1464cbed-0321-45e2-b2c6-295862eb131d

📥 Commits

Reviewing files that changed from the base of the PR and between a06531b and 443cdb8.

📒 Files selected for processing (4)
  • src/web/client/MergeRow.tsx
  • src/web/client/styles.ts
  • src/web/client/types.ts
  • src/web/webServer.ts

Comment thread src/web/client/MergeRow.tsx Resolved
@Avni2000 Avni2000 self-assigned this Mar 14, 2026
…y whichever branch had content first, not by the user's actual selection.

- When a user clicks "Use Base/Current/Incoming", the editor immediately updates with correct syntax highlighting for that branch's cell type.
- Content area/3 way diff view
- Resolution bar button area
@Avni2000 Avni2000 changed the title Refactor CodeMirror theming and Markdown rendering pipeline Fix syntax highlighting, LaTeX rendering, and various other UI fixes Mar 14, 2026
@Avni2000
Avni2000 merged commit fd9ac96 into main Mar 14, 2026
5 checks passed
@Avni2000
Avni2000 deleted the ui-fixes branch March 20, 2026 20:19
@coderabbitai coderabbitai Bot mentioned this pull request Mar 22, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant