Skip to content

fix(lists): indent list items and hang their wrapped lines - #17

Merged
b451c merged 1 commit into
b451c:mainfrom
shmuelzon:indent-lists
Jul 27, 2026
Merged

fix(lists): indent list items and hang their wrapped lines#17
b451c merged 1 commit into
b451c:mainfrom
shmuelzon:indent-lists

Conversation

@shmuelzon

Copy link
Copy Markdown
Contributor

List items rendered as a plain paragraph whose only indentation was leading spaces. NSTextView's default paragraph style has zero head indents, so a wrapped item's continuation lines fell back to the marker's own margin — bullets, numbers, checkboxes and body text all shared one left edge.

Items now carry an AppKit paragraph style: a 16pt gutter in front of the marker, and a headIndent of gutter + the typeset width of the item's prefix so continuation lines hang under the item text. The width is measured from the actual marker, so "10." hangs further than "1.", and both follow ⌘+ / ⌘-. Bullets, ordered items and task checkboxes all go through it.

Also fixes the nesting level, which was ceil(columns / 4) and put a 2-space-nested child on its parent's margin. Now one level per two columns (one per tab), capped at 8, so 2- and 4-space documents both keep every level distinct.

Nesting stays in the characters as well as the paragraph style: the print/PDF pipeline renders text blocks through SwiftUI Text, which ignores NSParagraphStyle, so it keeps today's space-based nesting and simply degrades to flush-left wrapping.

List items rendered as a plain paragraph whose only indentation was
leading spaces. NSTextView's default paragraph style has zero head
indents, so a wrapped item's continuation lines fell back to the
marker's own margin — bullets, numbers, checkboxes and body text all
shared one left edge.

Items now carry an AppKit paragraph style: a 16pt gutter in front of the
marker, and a headIndent of gutter + the typeset width of the item's
prefix so continuation lines hang under the item text. The width is
measured from the actual marker, so "10." hangs further than "1.", and
both follow ⌘+ / ⌘-. Bullets, ordered items and task checkboxes all go
through it.

Also fixes the nesting level, which was ceil(columns / 4) and put a
2-space-nested child on its parent's margin. Now one level per two
columns (one per tab), capped at 8, so 2- and 4-space documents both
keep every level distinct.

Nesting stays in the characters as well as the paragraph style: the
print/PDF pipeline renders text blocks through SwiftUI Text, which
ignores NSParagraphStyle, so it keeps today's space-based nesting and
simply degrades to flush-left wrapping.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@b451c
b451c merged commit c59ce4f into b451c:main Jul 27, 2026
3 checks passed
@b451c

b451c commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Merged - beautiful work. The hanging indent measured from the actual marker width (so "10." hangs further than "1."), the one-level-per-two-columns nesting that keeps both 2-space and 4-space documents distinct, and the zoom-aware indents all show real care. Special credit for documenting the NSParagraphStyle exception to the dual-scope rule and keeping nesting in the characters so the print/PDF pipeline degrades gracefully - both of those saved me review questions.

Verified: all 7 new tests green, full suite passes, wrapped items confirmed hanging correctly in a running build. Ships in v1.7.0. Two great fixes in one evening - thank you!

@shmuelzon
shmuelzon deleted the indent-lists branch July 27, 2026 20:52
@b451c

b451c commented Jul 27, 2026

Copy link
Copy Markdown
Owner

v1.7.0 with this change is now live: https://github.com/b451c/quickmd/releases/tag/v1.7.0 - thanks again!

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.

2 participants