Skip to content

fix(colab): Add linter for malformed lists in generated notebooks - #3947

Draft
ribhuji wants to merge 1 commit into
pytorch:mainfrom
ribhuji:fix-indentation
Draft

fix(colab): Add linter for malformed lists in generated notebooks#3947
ribhuji wants to merge 1 commit into
pytorch:mainfrom
ribhuji:fix-indentation

Conversation

@ribhuji

@ribhuji ribhuji commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #3946

Description

Some list structures in Sphinx-Gallery tutorial sources render correctly in the HTML documentation but become malformed after conversion to Markdown in the generated Google Colab notebooks.

This PR adds a repository-local TUTORIAL_MARKUP Lintrunner check that detects the two source patterns responsible for the problems documented in #3946:

  • indented lists that begin without a separating blank narrative line; and
  • list continuation lines that are not indented beneath their list item.

The checker only examines Sphinx-Gallery narrative content from module docstrings and gallery comment blocks. It accounts for valid nested lists, reStructuredText directives, and list tables to avoid reporting those as violations.

Validation strategy

This draft is being built in two commits so the Lintrunner behavior can be verified directly in GitHub Actions:

  1. Add and register the linter.
    The expected CI result is 14 diagnostics across exactly the 10 tutorials documented in [BUG] - Incorrect list rendering in Google Colab tutorials #3946, with no additional tutorial files reported.
  2. Fix the detected violations.
    The subsequent CI run should pass with no TUTORIAL_MARKUP diagnostics.

Local validation

python3 -m unittest discover -s tools/linter/tests -p 'test_*.py'
lintrunner --all-files --take TUTORIAL_MARKUP

The unit test suite currently passes all eight tests. The complete linter scan reports 14 diagnostics across the 10 affected tutorial files and reports no other tutorial files.

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request
  • No unnecessary issues are included into this pull request.

@pytorch-bot

pytorch-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3947

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the cla signed label Aug 3, 2026
@ribhuji
ribhuji marked this pull request as draft August 3, 2026 10:22
@ribhuji

ribhuji commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@albanD, could you please approve the workflow run for this draft PR?

The current commit intentionally contains only the new Lintrunner check. The job is expected to fail with 14 diagnostics across the 10 tutorials documented in #3946, which will validate that the check detects the existing issues.

Once that run is recorded, I’ll push a second commit fixing those violations. This will preserve both the detection run and the final passing run in the PR history. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - Incorrect list rendering in Google Colab tutorials

1 participant