fix(bug): list continuation line handling and refactor shared utilities#110
Merged
YousefHadder merged 2 commits intomainfrom Nov 5, 2025
Merged
fix(bug): list continuation line handling and refactor shared utilities#110YousefHadder merged 2 commits intomainfrom
YousefHadder merged 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where continuation lines (created with Alt-Enter) were incorrectly treated as list breaks, causing ordered list items to be renumbered unexpectedly. It also consolidates ~180 lines of duplicate code into a shared utilities module.
Key changes:
- Introduced continuation line detection to prevent incorrect list break detection
- Created
shared.luamodule to centralize common list utilities - Renamed
handle_shift_entertocontinue_list_contentfor better clarity
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lua/markdown-plus/list/shared.lua | New module containing shared utilities for list handling (continuation line detection, content extraction, marker generation) |
| lua/markdown-plus/list/renumber.lua | Updated to use shared utilities and check for continuation lines before treating lines as list breaks |
| lua/markdown-plus/list/handlers.lua | Refactored to use shared utilities; renamed handle_shift_enter to continue_list_content |
| lua/markdown-plus/list/init.lua | Updated function name reference from handle_shift_enter to continue_list_content |
| spec/markdown-plus/list_spec.lua | Added 4 tests for continuation line scenarios; updated function name references |
| doc/markdown-plus.txt | Updated documentation for renamed function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a bug where pressing Alt-Enter on an ordered list item caused subsequent items to be incorrectly renumbered, and includes code quality improvements.
Changes
Bug Fix
is_continuation_linedetection logic to prevent treating continuation lines as list-breaking linesis_list_breaking_lineto check for continuation lines before treating blank/non-list lines as breaksRefactoring
lua/markdown-plus/list/shared.luamodule to eliminate ~180 lines of duplicate codeis_orderable_type,extract_list_content,get_content_start_col,get_marker_for_index,find_parent_list_item,is_continuation_linehandlers.luaandrenumber.luato use shared utilitiesFunction Rename
handle_shift_entertocontinue_list_contentfor clarityTesting
Files Changed
lua/markdown-plus/list/shared.lua(new)lua/markdown-plus/list/handlers.lualua/markdown-plus/list/renumber.lualua/markdown-plus/list/init.luaspec/markdown-plus/list_spec.luadoc/markdown-plus.txt