fix: align numbered markdown lists when first token is bold#458
Conversation
📝 WalkthroughWalkthroughModified markdown styling configuration to adjust list rendering. Changes include adding padding to ordered list items, switching paragraph children in list items from inline to block display, and adding tabular-numbers styling to ordered list markers. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR fixes numbered list alignment when list items start with bold or other styled inline content. The fix changes Key changes:
Issues found:
Confidence Score: 4/5
Important Files Changed
Last reviewed commit: 5c5351e |
| ${s} li { margin: ${compactSpacing ? '0' : '0.25em 0'} !important; ${compactSpacing ? 'padding: 0;' : ''} line-height: 1.4; display: list-item; } | ||
| ${s} li > p { margin: 0 !important; display: inline; vertical-align: baseline; line-height: inherit; } | ||
| ${s} ol li { padding-left: 0.15em; } | ||
| ${s} li > p { margin: 0 !important; display: block; line-height: inherit; } |
There was a problem hiding this comment.
Test at src/__tests__/renderer/utils/markdownConfig.test.ts:227-232 expects display: inline; vertical-align: baseline; but now it's display: block - update test expectations
| ${s} li > p { margin: 0 !important; display: block; line-height: inherit; } | |
| ${s} li > p { margin: 0 !important; display: block; line-height: inherit; } |
Additional Comments (1)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/utils/markdownConfig.ts (1)
128-128: Keep list-paragraph behavior consistent across prose generators.Line 128 fixes the issue in
generateProseStyles, butgenerateTerminalProseStylesstill keepsli > pinline (Line 507), so the same misalignment can still appear in terminal/group-chat markdown.Suggested parity update in
generateTerminalProseStyles- ${s} li > p { margin: 0 !important; display: inline; vertical-align: baseline; line-height: inherit; } + ${s} ol li { padding-left: 0.15em; } + ${s} li > p { margin: 0 !important; display: block; line-height: inherit; } @@ - ${s} li::marker { font-weight: normal; } + ${s} li::marker { font-weight: normal; } + ${s} ol li::marker { font-variant-numeric: tabular-nums; font-weight: 400; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/renderer/utils/markdownConfig.ts` at line 128, generateTerminalProseStyles still leaves the selector "li > p" inline causing list misalignment; mirror the fix from generateProseStyles by updating the "li > p" rule inside generateTerminalProseStyles to set margin: 0 !important, display: block, and line-height: inherit (match the exact properties used in generateProseStyles) so terminal/group-chat markdown renders paragraph children of list items consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/renderer/utils/markdownConfig.ts`:
- Line 128: generateTerminalProseStyles still leaves the selector "li > p"
inline causing list misalignment; mirror the fix from generateProseStyles by
updating the "li > p" rule inside generateTerminalProseStyles to set margin: 0
!important, display: block, and line-height: inherit (match the exact properties
used in generateProseStyles) so terminal/group-chat markdown renders paragraph
children of list items consistently.
Summary
Fixes numbered list alignment in markdown when a list item starts with bold (or other styled inline) content.
Problem
In some markdown content, ordered-list markers become visually misaligned when the first inline token is styled (for example
**bold**).Root cause
The prose style layer rendered
li > pasinline, which can create marker/baseline inconsistencies with styled first tokens in ordered lists.What changed
li > pfromdisplay: inlinetodisplay: blockol li { padding-left: 0.15em; }ol li::marker { font-variant-numeric: tabular-nums; font-weight: 400; }Validation
generateProseStyles) and compared before/after behavior with ordered lists containing bold-leading items.Scope
Summary by CodeRabbit