Skip to content

Fix Sphinx homepage toctree rendering in index.md - #15315

Closed
cclauss with Copilot wants to merge 7 commits into
masterfrom
copilot/fix-sphinx-docs
Closed

cclauss with Copilot wants to merge 7 commits into
masterfrom
copilot/fix-sphinx-docs

Conversation

Copilot AI commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Describe your change

Sphinx docs were building, but the homepage content was effectively unusable because the root toctree in index.md was parsed as a code block instead of a directive. This PR corrects the MyST directive syntax so the homepage renders navigable docs content.

  • Root cause
    • index.md used an invalid fenced directive form: ```text {toctree}
  • Change made
    • Replaced it with valid MyST directive syntax: ```{toctree}
    • No workflow logic changes were needed in .github/workflows/sphinx.yml
  • Snippet
    -```text {toctree}
    +```{toctree}
    :maxdepth: 2
    :caption: index.md
  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
  • Documentation change?

Checklist

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues, then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

Copilot AI linked an issue Sep 13, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits September 13, 2026 11:53
Co-authored-by: cclauss <3709715+cclauss@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Sphinx docs generation process Fix Sphinx homepage toctree rendering in index.md Sep 13, 2026
Copilot AI requested a review from cclauss September 13, 2026 11:54
@priya-sundaram-dev

Copy link
Copy Markdown
Contributor

Nice catch on the root cause 👍 I reproduced this locally to confirm, and the diagnosis is exactly right:

  • Before (```text {toctree}): MyST parses it as a plain text code block, so the directive never runs. The build emits document isn't included in any toctree for CONTRIBUTING.md, README.md, and LICENSE.md, and the homepage renders zero navigation entries.
  • After (```{toctree}): the directive fires and the homepage gets a working table of contents (14 toctree-l1 links in my minimal repro).

One small follow-up while you're in here: with the directive now active, the HTML comment line inside the toctree body is treated as a doc reference and produces a warning:

index.md:3: WARNING: toctree contains reference to nonexisting document
'<!-- CONTRIBUTING.md must be the FIRST doc and README.md can come after. -->'

Directive bodies aren't Markdown, so the <!-- ... --> isn't stripped. Moving that note above the fence (or into :caption:) clears the warning and keeps the intent:

<!-- CONTRIBUTING.md must be the FIRST doc; README.md can come after. -->
```{toctree}
:maxdepth: 2
:caption: index.md

CONTRIBUTING.md
README.md
LICENSE.md

Verified locally that removing the comment line leaves a clean build with the full ToC. The `DIRECTORY.md` line in this PR looks like an unrelated auto-generated add. Core fix LGTM.

@cclauss

cclauss commented Sep 13, 2026

Copy link
Copy Markdown
Member

In pre-commit:

rumdl fmt................................................................Failed
- hook id: rumdl-fmt
- files were modified by this hook

index.md:3:1: [MD040] Code block (```) missing language [fixed]

Fixed: Fixed 1/1 issues in 1 file (31ms)

https://rumdl.dev/md040 and https://rumdl.dev/md073

So we have to modify:

Python/pyproject.toml

Lines 235 to 244 in be65e47

[tool.rumdl]
disable = [
# "MD013",
"MD033",
"MD036",
"MD041",
]
exclude = [ "DIRECTORY.md", "docs/hacktober_2026_prep.md" ]
flavor = "gfm"
line-length = 350

to add...

per-file-ignores."index.md" = [ "MD040" ]

@github-actions
github-actions Bot force-pushed the copilot/fix-sphinx-docs branch from 7168490 to b5e4908 Compare September 13, 2026 13:15
@cclauss
cclauss marked this pull request as ready for review September 13, 2026 13:20
@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed documentation This PR modified documentation files labels Sep 13, 2026

@cclauss cclauss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label Sep 13, 2026
@cclauss
cclauss requested a review from poyea September 13, 2026 13:24
@algorithms-keeper algorithms-keeper Bot added the awaiting reviews This PR is ready to be reviewed label Sep 13, 2026
@cclauss
cclauss removed the request for review from poyea September 13, 2026 13:50
@cclauss

cclauss commented Sep 13, 2026

Copy link
Copy Markdown
Member

Zero files changed.

@cclauss cclauss closed this Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed documentation This PR modified documentation files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sphinx docs are not working

3 participants