GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add independent list instances and continuation paragraphs by pseudosavant · Pull Request #1614 · python-openxml/python-docx

Conversation

@pseudosavant

@pseudosavant pseudosavant commented Sep 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Problem

Paragraph styles alone do not give document generators control over list identity, starting numbers, or unnumbered continuation paragraphs. This adds a draft public API for those operations using numbering already present in a document or template.

API

  • Document.add_list(style="List Number", start=1, level=None) creates an independent sequence.
  • ListInstance.apply(paragraph, level=None) numbers a paragraph without changing its style.
  • restart(start=1, level=None) returns an independent sequence.
  • apply_continuation(paragraph, level=None) suppresses numbering and preserves text alignment.
  • levels and default_level expose template level selection.

A caller resumes a sequence by applying the same handle again. Separate abstract definitions preserve independent counters when sequences are interleaved. In Word, sharing an abstract definition caused a 3, 4, 1, 5 sequence to display 3, 4, 1, 2. The implementation copies the original definition and instance overrides without changing template definitions.

This intentionally starts with template-backed list authoring in the main story and table cells. It does not add arbitrary numbering-format authoring or numbering-style-link resolution. Undefined levels, invalid starts, and cross-document use are rejected before mutation. Continuation formatting is a snapshot. Word has no list-item container.

Validation

  • 1,634 unit tests and 652 acceptance scenarios passed against this branch based on upstream master.
  • New coverage includes independent starts and restarts, interleaved sequences, multi-paragraph items, template overrides, invalid references, and cross-document validation.
  • Microsoft Word verified starts, interleaved restart behavior, continuation indentation, and multilevel numbering with nested restarts.
  • Includes a Word-authored multilevel fixture and documentation of the observed behavior.

Design discussion

Related work includes #210 and #582. This draft focuses on a small public authoring API rather than a general numbering editor. API names, supported scope, and XML helper boundaries are open for review. My current downstream consumer is markdown-docx, and I can adapt it to upstream conventions.

This branch contains isolated feature commits based directly on upstream master. It has no fork packaging, version changes, or dependency on the fork's other features.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
pseudosavant added 3 commits September 24, 2026 11:34
@pseudosavant
Add independent list instances and continuation paragraphs
a0fe7df
@pseudosavant
Keep list style casts compatible with Python 3.9
cc85ffc
@pseudosavant
Expose list continuation indentation for nested blocks
8b7f2db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@pseudosavant
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.