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 — gh-139257: escape enumerator-like letters to support docutils 0.22 by stefanor · Pull Request #140031 · python/cpython

Conversation

@stefanor

@stefanor stefanor commented Oct 13, 2025 •
edited by github-actions Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Escape things that look like Roman numerals. Docutils 0.22 includes a new roman-numeral interpreter that falls over some of our content. Escape anything that causes trouble.

Python itself isn't using docutils 0.22 yet for its doc generation, but some Linux distributions have updated to it.

An alternative to GH-139258

  • Issue: Documentation doesn't generate with docutils >= 0.22 #139257

📚 Documentation preview 📚: https://cpython-previews--140031.org.readthedocs.build/

Sorry, something went wrong.

Uh oh!

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

All reactions
@stefanor
stefanor requested review from AA-Turner, gpshead, picnixz, rhettinger and willingc as code owners October 13, 2025 10:39
@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels Oct 13, 2025
@github-project-automation github-project-automation Bot added this to Docs PRs Oct 13, 2025
@bedevere-app bedevere-app Bot added the awaiting review label Oct 13, 2025
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Oct 13, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Oct 13, 2025
Documentation doesn't generate with docutils >= 0.22 #139257
Closed
@stefanor
pythongh-139257: docutils 0.22 support
799e7bb
Escape things that look like Roman numerals. Docutils 0.22 includes a
new roman-numeral interpreter that falls over some of our content.
Escape anything that causes trouble.

Python itself isn't using docutils 0.22 yet for its doc generation, but
some Linux distributions have updated to it.
@stefanor
stefanor force-pushed the docutils-0.22 branch from 8920f8f to 799e7bb Compare October 13, 2025 10:42
picnixz
picnixz approved these changes Oct 13, 2025
View reviewed changes

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Well, if this change is actually sufficient it's good. But that means that we need to be careful when adding roman-like text. What I find annoying is the Q/A modifications, but I don't know how we could do otherwise.

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Oct 13, 2025
@picnixz picnixz changed the title gh-139257: docutils 0.22 support gh-139257: escape roman-like words to support docutils 0.22 Oct 13, 2025
@picnixz picnixz changed the title gh-139257: escape roman-like words to support docutils 0.22 gh-139257: escape enumerator-like letters to support docutils 0.22 Oct 13, 2025
@AA-Turner

AA-Turner commented Oct 13, 2025

Copy link
Copy Markdown
Member

This feels like a Docutils bug if it requires this much escaping?

A

zware reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@stefanor
stefanor requested a review from hugovk as a code owner October 13, 2025 11:02
@picnixz

picnixz commented Oct 13, 2025

Copy link
Copy Markdown
Member

This feels like a Docutils bug if it requires this much escaping?

That's because we have no way of disabling roman numeral handling in docutils >= 0.22, unless we specify compatible enumerator-like objects (that are implementation details in docutils and only in >= 0.22). See the issue for the commit that changed this.

All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz

picnixz commented Oct 13, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Note: what would be ideal is for docutils to check first the return value of a converter, and if it is None, then assume that the conversion is disabled. That would be the cleanest way to do it (and our monkey patch would be compatible with older docutils versions)

All reactions

Sorry, something went wrong.

Uh oh!

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

@stefanor

stefanor commented Oct 13, 2025

Copy link
Copy Markdown
Contributor Author

This feels like a Docutils bug if it requires this much escaping?

Presumably that's what @birkenfeld thought when implementing the monkey-patch in #48813.

The alternative here is to re-instate #139258 and update the monkey-patch.

All reactions

Sorry, something went wrong.

Uh oh!

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

@stefanor

stefanor commented Oct 13, 2025

Copy link
Copy Markdown
Contributor Author

I added a second commit to remove the monkey-patch entirely. But instead of doing that, we could make it raise an explicit exception, to avoid accidentally introducing Roman-numbered lists.

All reactions

Sorry, something went wrong.

Uh oh!

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

@hugovk

hugovk commented Oct 13, 2025

Copy link
Copy Markdown
Member

What I find annoying is the Q/A modifications, but I don't know how we could do otherwise.

Other FAQs use headings for the questions, which also makes them linkable:

  • https://docs.python.org/3/faq/design.html#why-does-python-use-indentation-for-grouping-of-statements
  • https://docs.python.org/3/faq/extending.html#how-do-i-catch-the-output-from-pyerr-print-or-anything-that-prints-to-stdout-stderr
All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz

picnixz commented Oct 13, 2025

Copy link
Copy Markdown
Member

Other FAQs use headings for the questions, which also makes them linkable:

That would indeed be better. I think we have two distinct issues:

  • Transform Q/A into headers (independent of docutils support, this is indeed better and more helpful for users and for us if we want to link them).
  • Either patch our current docs to avoid the enumerator conversion, or patch docutils directly so that we can provide a "noop" enumerator.
hugovk reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

stefanor added 3 commits October 15, 2025 16:53
@stefanor
Replace the monkey patch to disable roman lists with an exception
220e71a
We don't have a single clean method to disable roman lists across
docutils versions, but we can blow up the bulid cleanly...
@stefanor
Use an explicitly named link
85a5688
Docutils 0.22 does not allow referencing a link that was implicitly
named earlier in the document, it complains:

  ERROR: Duplicate target name, cannot be used as a unique reference:
  "basic authentication".
@stefanor
Render the FAQ local tables of contents for all media
8e6c0cc
Docutils 0.22 doesn't allow the contents directive to be used within an
only directive, it complains:

  ERROR: The "contents" directive may not be used within topics or body
  elements.
@stefanor
stefanor force-pushed the docutils-0.22 branch from feb1cfd to 8e6c0cc Compare October 15, 2025 14:53
@stefanor

stefanor commented Oct 15, 2025

Copy link
Copy Markdown
Contributor Author

But instead of doing that, we could make it raise an explicit exception, to avoid accidentally introducing Roman-numbered lists.

Changed to that.

Also, added a couple of additional commits for other docutils 0.22 issues.

All reactions

Sorry, something went wrong.

Uh oh!

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

@picnixz picnixz mentioned this pull request Nov 29, 2025
GH-121970: Remove Docutils list monkeypatch #142056
Merged
@hugovk

hugovk commented Nov 29, 2025

Copy link
Copy Markdown
Member

See PR #142056 for an alternative.

All reactions

Sorry, something went wrong.

Uh oh!

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

@AA-Turner AA-Turner closed this Nov 29, 2025
@stefanor
stefanor deleted the docutils-0.22 branch November 29, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz approved these changes
@rhettinger rhettinger Awaiting requested review from rhettinger rhettinger is a code owner
@gpshead gpshead Awaiting requested review from gpshead gpshead is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner
@willingc willingc Awaiting requested review from willingc willingc is a code owner
@hugovk hugovk Awaiting requested review from hugovk hugovk is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

awaiting merge docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Todo

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.

4 participants

@stefanor @AA-Turner @picnixz @hugovk
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.