Skip to content

fix(lists): expand tabs in the indentation to four-column stops - #67

Merged
delphinus merged 1 commit into
mainfrom
fix/leading-tab-indent
Sep 24, 2026
Merged

delphinus merged 1 commit into
mainfrom
fix/leading-tab-indent

Conversation

@delphinus

Copy link
Copy Markdown
Owner

Everything that measures indentation counts spaces, so a list item indented with a tab was one column deep instead of four. A tab-indented item under another item did not nest:

- outer
	- inner item long enough to wrap onto a second line
  • its continuation lines hung from the parent's column, not the nested item's text;
  • the tab itself reached the buffer, where 'tabstop' (8 by default) pushed the marker further right than the hanging indent assumed.

The fix

render_document expands tabs in each line's leading whitespace before anything measures it, with tab stops every four columns as CommonMark specifies. \t- item now renders exactly as - item does, and \t stops at column 4. Fenced code is left alone, since its tabs are content.

Tests

tests/list_indent_test.lua gains Test 10:

  • a tab-indented nested item renders the same as a four-space one;
  • its wrapped continuation hangs under its own text;
  • no tab reaches the output;
  • a tab after spaces stops at column four;
  • a tab inside fenced code stays.

Four of these assertions fail without the fix. make test passes.

🤖 Generated with Claude Code

Everything that measures indentation counts spaces, so a list item
indented with a tab was one column deep instead of four. A tab-indented
item under another item did not nest: its continuation lines hung from the
parent's column, and the tab itself reached the buffer, where 'tabstop'
(8 by default) pushed the marker further right than its text's hanging
indent assumed.

render_document now expands tabs in each line's leading whitespace before
anything measures it, with tab stops every four columns as CommonMark
specifies, so `\t- item` renders exactly as `    - item` does. Fenced code
is left alone, since its tabs are content.

tests/list_indent_test.lua gains a case for a tab-indented nested item,
a tab after spaces, and a tab inside fenced code. Four of its assertions
fail before this change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@delphinus
delphinus merged commit 865dcce into main Sep 24, 2026
38 checks passed
@delphinus
delphinus deleted the fix/leading-tab-indent branch September 24, 2026 03:45
denny0223 pushed a commit to denny0223/md-render.nvim that referenced this pull request Sep 24, 2026
…hinus#67)

Everything that measures indentation counts spaces, so a list item
indented with a tab was one column deep instead of four. A tab-indented
item under another item did not nest: its continuation lines hung from the
parent's column, and the tab itself reached the buffer, where 'tabstop'
(8 by default) pushed the marker further right than its text's hanging
indent assumed.

render_document now expands tabs in each line's leading whitespace before
anything measures it, with tab stops every four columns as CommonMark
specifies, so `\t- item` renders exactly as `    - item` does. Fenced code
is left alone, since its tabs are content.

tests/list_indent_test.lua gains a case for a tab-indented nested item,
a tab after spaces, and a tab inside fenced code. Four of its assertions
fail before this change.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 865dcce)
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