Skip to content

fix: Doc Maker content duplication bug and add nested/parenthesized list support#321

Merged
QuantumNightmare merged 29 commits into
masterfrom
jf-fix-doc-maker-duplication-bug
May 14, 2026
Merged

fix: Doc Maker content duplication bug and add nested/parenthesized list support#321
QuantumNightmare merged 29 commits into
masterfrom
jf-fix-doc-maker-duplication-bug

Conversation

@QuantumNightmare
Copy link
Copy Markdown
Contributor

@QuantumNightmare QuantumNightmare commented May 12, 2026

Description

  • Purpose: Fix a bug in the Doc Maker integration where content inside list items was being duplicated due to recursive element traversal stepping down into nested elements within a list item. Also adds support for nested lists, parenthesized numbering formats (1), (a), (i) etc., and numbered list continuation across document sections.

  • Approach: Adds recursive=False to the top-level soup.find_all() call to prevent double-processing of nested elements. Introduces a new _add_list_items() function that recursively handles nested <ul>/<ol> elements with proper OOXML numbering definitions. Adds _post_process_paren_lists() to detect and convert (a), (1), (i) text patterns into proper nested <ol> elements before processing. Implements low-level OOXML numbering helpers (_get_or_create_abstract_num, _create_num, _apply_numbering, _patch_abstract_num_level) to produce correct multilevel Word numbering with consistent hanging indents. Updates _add_formatted_text_to_paragraph() with a skip_nested_lists flag to avoid re-processing nested list content.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Screenshots

image image image image image image image

Test plan

Exercises the new and fixed list-rendering logic in parse_markdown_to_docx.

  1. Run the new unit tests in doc-maker/tests/test_doc_maker_unit.py:
    • TestParenthesizedListNumbering — verifies nested (a)/(1)/(i) lists share a single numId, correct ilvl values, and correct numFmt per level.
    • TestMultipleParenListsAfterHeadings — verifies that independent paren lists separated by headings each get their own abstractNum and all items are numbered.
    • TestMixedNumberedListFormats — verifies all five list styles (1., (1), (a), (A), (i)) render with the correct numFmt, parenthesized lvlText, left-alignment, and consistent hanging indent.
    • TestOrderedListStartOverride — verifies numbered list continuation across headings respects the start number (4. five six following 1. two three).
    • TestNestedNumberedListIndentation — verifies deeply nested (5-level) mixed-format lists produce correct ilvl, numFmt, and left indent values (hanging × (ilvl + 1)).
  2. Generate a .docx from a markdown document containing nested and parenthesized lists and open it in Word/LibreOffice to visually confirm no duplication and correct formatting.

Author(s) to check

  • Project and all contained modules builds successfully
  • Self-/dev-tested
  • Unit/UI/Automation/Integration tests provided where applicable
  • Code is written to standards
  • Appropriate documentation written (code comments, internal docs)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

🔍 Integration Validation Results

Commit: 430e4f3ca6cfefb8544f1668534dc9bc2057b77b · This is a feature enhancement and bug fixes, not a breaking change
Updated: 2026-05-14T02:36:40Z

Changed directories: doc-maker

Check Result
Structure ✅ Passed
Code ✅ Passed
Tests ✅ Passed
README ✅ Passed
Version ✅ Passed
✅ Structure Check output
Validating 1 integration(s)...

============================================================
Integration: doc-maker
============================================================
✅ All checks passed!

============================================================
SUMMARY
============================================================
Integrations validated: 1
Total errors: 0
Total warnings: 0

✅ All validations passed!
✅ Code Check output

[notice] A new release of pip is available: 26.0.1 -> 26.1.1
[notice] To update, run: pip install --upgrade pip
----------------------------------------
Checking: doc-maker
----------------------------------------

📦 Installing dependencies...

🐍 Checking Python syntax...
   ✅ Syntax OK

📥 Checking imports...
   ✅ Imports OK

📄 Checking JSON files...
   ✅ JSON files OK

🔍 Linting with ruff...
   ✅ Lint OK

🎨 Checking formatting with ruff...
   ✅ Formatting OK

🔒 Scanning for security issues with bandit...
   ✅ Security OK

🛡️ Checking dependencies for vulnerabilities with pip-audit...
   ✅ Dependencies OK

🔗 Checking config-code sync...
   ✅ Config-code sync OK

🔄 Checking fetch patterns...
   ✅ Fetch patterns OK

========================================
✅ CODE CHECK PASSED
========================================
✅ Tests Check output

Integration   Tests  Coverage        Status
-------------------------------------------
doc-maker   100/100       66%      ✅ Passed
-------------------------------------------
Total       100/100            ✅ All passed

✅ Tests passed: doc-maker
✅ README Check output
========================================
✅ README CHECK PASSED
========================================
✅ Version Check output
✅ doc-maker: 2.0.0 → 2.1.0 (minor bump)

========================================
✅ VERSION CHECK PASSED
========================================

Comment thread doc-maker/tests/test_doc_maker_unit.py Fixed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dd617f1bf4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread doc-maker/doc_maker.py Outdated
Comment thread doc-maker/doc_maker.py Outdated
@QuantumNightmare QuantumNightmare changed the title Fix Doc Maker content duplication bug and add nested/parenthesized list support fix: Doc Maker content duplication bug and add nested/parenthesized list support May 12, 2026
Comment thread doc-maker/doc_maker.py
Copy link
Copy Markdown
Contributor

@Ilikecarpet Ilikecarpet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for working on this.

@QuantumNightmare QuantumNightmare merged commit 6faab80 into master May 14, 2026
3 checks passed
@QuantumNightmare QuantumNightmare deleted the jf-fix-doc-maker-duplication-bug branch May 14, 2026 04:50
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