Skip to content

Fix heading preservation during manual reorder#782

Open
opt12 wants to merge 6 commits into
doorstop-dev:developfrom
opt12:246---handle-headings-durign-reorder
Open

Fix heading preservation during manual reorder#782
opt12 wants to merge 6 commits into
doorstop-dev:developfrom
opt12:246---handle-headings-durign-reorder

Conversation

@opt12

@opt12 opt12 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

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:

- REQ001: # HEADING # Overview

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:

- REQ001: # HEADING # Overview
- REQ001: # heading    # Overview

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 as 1.1.0 remains 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 item header as 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:

  • how heading items are represented in index.yml
  • how to create new heading items using # heading #
  • that header text is preferred over item text in the generated index comments

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.yml generated during manual reorder. Existing index files without the marker continue to work as before.

Felix Eckstein (Ext.) and others added 2 commits June 26, 2026 12:16
…#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>
opt12 and others added 2 commits June 26, 2026 11:16
…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>
@opt12

opt12 commented Jun 26, 2026

Copy link
Copy Markdown
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.

@opt12 opt12 mentioned this pull request Jun 26, 2026
@opt12

opt12 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

i fixed the merge conflict.
It should work now.
(moved some section in the test by accident which was not automagically recognized.)

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.

Headings are lost during reorder

3 participants