Fix heading preservation during manual reorder#782
Open
opt12 wants to merge 6 commits into
Open
Conversation
…#780) * no more error when running in a worktree * - added additional test case: REQ007 with a requirement of "Heading"-type - updated the creation of the golden master files * - updated the golden master files to include the additional REQ007 test case * running checks and repaired makefile * - undo makefile changes as it's out of scope of issue --------- Co-authored-by: Felix Eckstein (Ext.) <Felix.Eckstein@sieb-meyer.de>
jacebrowning
approved these changes
Jun 26, 2026
…errors. (doorstop-dev#777) Co-authored-by: Felix Eckstein (Ext.) <Felix.Eckstein@sieb-meyer.de>
- Upgrade four http:// badge/page URLs to https:// - Update Poetry project URL from retired poetry.eustace.io to python-poetry.org Co-authored-by: TejasAmle <tejas.amle71@gmail.com>
Contributor
Author
|
@jacebrowning Thank you! I very much appreciate, that you still invest a lot of time into this project. I try to check whether this also fixes #736. |
added 2 commits
June 26, 2026 21:40
….com/opt12/doorstop into 246---handle-headings-durign-reorder
Contributor
Author
|
i fixed the merge conflict. |
jacebrowning
approved these changes
Jun 26, 2026
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.
Description
This PR fixes heading handling during manual reorder and addresses the long-standing issue described in #246.
What changed
Manual reorder now preserves heading items explicitly in
index.yml.Existing heading items are written with a marker:
When the index is read back, this marker is recognized and the item keeps its heading level, including the trailing
.0. This also works for headings without child items, which was the root cause of #246.The marker is parsed case-insensitively and tolerates additional whitespace, for example:
Relation to #246
Issue #246 reports that heading items without child items lose their heading status during manual reorder because Doorstop previously inferred headings mainly from the index structure.
With this PR, heading information is stored explicitly in the generated
index.yml, so a heading such as1.1.0remains a heading after reorder even if it has no child items.This should close #246.
Index comments
When generating
index.yml, Doorstop now prefers the itemheaderas the comment text if one exists. If no header is set, it falls back to the beginning of the item text.For heading items, the comment is prefixed with
# HEADING #.Documentation
The reorder documentation was updated to explain:
index.yml# heading #Compatibility
There are no breaking changes for existing requirement data.
Existing item files do not need to be changed. The new marker is only used in the temporary
index.ymlgenerated during manual reorder. Existing index files without the marker continue to work as before.