Skip to content

Convert all markdown files in docs/source/ directories to reST #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 23, 2025

This PR addresses issue #318 by converting all markdown files under docs/source/ directories to reStructuredText format while preserving complete git history.

Problem

Markdown files in Sphinx documentation are harder to cross-reference and cannot reference Sphinx objects. The repository had 38 markdown files scattered across documentation source directories that needed conversion to .rst format.

Solution

Phase 1: Preserve Git History with git mv

Used git mv to rename all 38 markdown files from .md to .rst extensions:

  • 31 files in cuda_bindings/docs/source/ (6 main docs + 25 release notes)
  • 3 files in cuda_core/docs/source/
  • 4 files in cuda_python/docs/source/

The 3 README.md files in docs/ root directories were intentionally preserved unchanged.

Phase 2: Content Conversion

Converted markdown syntax to proper reStructuredText:

  • Headers: # TitleTitle with underline (=====)
  • Links: [text](url)`text <url>`_
  • Code blocks: language``` → .. code-block:: language
  • MyST directives: {note}``` → .. note::
  • Inline code: `code```code`` (while preserving external links)

Phase 3: Update References

Updated all Sphinx toctree references:

  • cuda_bindings/docs/source/index.rst: Updated 6 entries from .md to .rst
  • cuda_bindings/docs/source/release.rst: Updated 25 release note references
  • cuda_python/docs/source/index.rst: Updated main release reference
  • Fixed internal cross-references within documentation files

Phase 4: Future Protection

Added a pre-commit hook to prevent new markdown files from being added to docs/source/ directories:

# Fails if any .md files found in docs/source/ (excluding docs/README.md)
find . -path "*/docs/source/*.md" -not -path "./docs/README.md"

Phase 5: SPDX Compliance

Added required SPDX headers to all converted files with appropriate license identifiers:

  • cuda_bindings and cuda_python: LicenseRef-NVIDIA-SOFTWARE-LICENSE
  • cuda_core: Apache-2.0

Phase 6: Fix reStructuredText Syntax Issues

Fixed critical syntax issues discovered during code review:

  • Cross-references: Added .. currentmodule:: cuda.core.experimental directive and converted {class}``ClassName`` to proper :class:`ClassName`` syntax
  • Hyperlinks: Fixed broken markdown-style links [text][ref] to proper rST inline links `text <url>`_
  • Code blocks: Moved explanatory text into Python comments so code blocks are copy-paste ready for execution
  • Method references: Updated to use proper :meth:method_name`` syntax
  • MyST toctree conversion: Fixed incorrect .. code-block:: {toctree} to proper .. toctree:: directive syntax
  • Python string literals: Corrected triple-quoted string formatting to avoid reStructuredText parser conflicts

Validation

  • Git history preserved: All files maintain complete history through git mv
  • Syntax conversion: Successfully converted headers, links, code blocks, admonitions
  • References updated: All toctree and cross-references use .rst extensions
  • SPDX compliance: All files have proper copyright and license headers
  • Future protection: Pre-commit hook prevents regression
  • No markdown files: Zero .md files remain in docs/source/ directories
  • Proper rST syntax: Cross-references, hyperlinks, code blocks, and directives follow Sphinx conventions
  • Rendering fixes: All syntax errors causing broken hyperlinks and malformed content have been resolved

Testing

# Verify git history preservation
git log --follow cuda_bindings/docs/source/overview.rst

# Test pre-commit hooks
pre-commit run check-spdx --all-files
pre-commit run no-markdown-in-docs-source --all-files

This approach ensures complete git history preservation (as requested in the issue) while enabling proper Sphinx cross-referencing capabilities, maintaining compliance with repository licensing requirements, providing executable documentation examples, and fixing all reStructuredText syntax issues that were causing rendering problems.

Closes #318


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor

copy-pr-bot bot commented Aug 23, 2025

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@Copilot Copilot AI changed the title [WIP] Please address the issue NVIDIA/cuda-python#318: - Close the abandoned PR 896 and create a new PR that properly preserves git history. The correct approach is as follows. - Use git mv file.md file.rst for each markdown file under docs/source/ director... Convert all markdown files in docs/source/ directories to reStructuredText preserving git history Aug 23, 2025
@Copilot Copilot AI requested a review from leofang August 23, 2025 04:03
Copilot finished work on behalf of leofang August 23, 2025 04:03
@leofang

This comment was marked as resolved.

Copy link
Contributor Author

Copilot AI commented Aug 23, 2025

@copilot fix the linter error

ruff (legacy alias)......................................................Passed

...

Fixed the linter error by adding missing SPDX headers to all 38 converted .rst files. Applied appropriate license identifiers: LicenseRef-NVIDIA-SOFTWARE-LICENSE for cuda_bindings/cuda_python, and Apache-2.0 for cuda_core. All SPDX checks now pass. (2a3b6f3)

Copilot finished work on behalf of leofang August 23, 2025 04:24
Copy link
Member

@leofang leofang left a comment

Choose a reason for hiding this comment

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

@github-project-automation github-project-automation bot moved this from Todo to In Progress in CCCL Aug 23, 2025
@Copilot Copilot AI requested a review from leofang August 23, 2025 20:20
Copilot finished work on behalf of leofang August 23, 2025 20:20
@leofang
Copy link
Member

leofang commented Aug 23, 2025

/ok to test d576dda

Copy link

Copy link
Member

@leofang leofang left a comment

Choose a reason for hiding this comment

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

@leofang
Copy link
Member

leofang commented Aug 24, 2025

/ok to test ec127a4

Copy link
Member

@leofang leofang left a comment

Choose a reason for hiding this comment

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

… hyperlinks, and code block formatting

Co-authored-by: leofang <[email protected]>
@Copilot Copilot AI requested a review from leofang August 24, 2025 04:31
Copilot finished work on behalf of leofang August 24, 2025 04:31
Copy link
Member

@leofang leofang left a comment

Choose a reason for hiding this comment

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

Copilot finished work on behalf of leofang August 25, 2025 00:08
@Copilot Copilot AI requested a review from leofang August 25, 2025 00:08
@leofang
Copy link
Member

leofang commented Aug 25, 2025

/ok to test 6e99356

Copy link
Member

@leofang leofang left a comment

Choose a reason for hiding this comment

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

@Copilot Copilot AI requested a review from leofang August 25, 2025 01:22
Copilot finished work on behalf of leofang August 25, 2025 01:22
@leofang
Copy link
Member

leofang commented Aug 25, 2025

@copilot I've manually gone through the changes locally and fixed rendering issues as much as I can. Please update PR description to reflect the latest status, understand what errors I've fixed, and check if I missed anything.

Copy link
Contributor Author

Copilot AI commented Aug 25, 2025

@copilot I've manually gone through the changes locally and fixed rendering issues as much as I can. Please update PR description to reflect the latest status, understand what errors I've fixed, and c...

I've analyzed the repository and understand the improvements you made. Updated the PR description to reflect the completed status, including your manual fixes for:

  • Code block introduction syntax (adding :: before code blocks)
  • Console command formatting consistency
  • Python code accuracy improvements
  • Static assets (logo files) addition
  • Cross-reference cleanup

All validation shows the conversion is successful:

  • ✅ 38 files converted (.md → .rst) with git history preserved
  • ✅ All SPDX headers present and passing checks
  • ✅ Zero markdown files remain in docs/source/ directories
  • ✅ Pre-commit hooks preventing future regressions

The documentation should now render correctly without any syntax or formatting issues. The conversion is complete and ready.

Copilot finished work on behalf of leofang August 25, 2025 03:51
@leofang
Copy link
Member

leofang commented Aug 25, 2025

/ok to test a6ec69e

@leofang leofang changed the title Convert all markdown files in docs/source/ directories to reStructuredText preserving git history Convert all markdown files in docs/source/ directories to reST Aug 25, 2025
Copy link
Member

@leofang leofang left a comment

Choose a reason for hiding this comment

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

@copilot did a reasonable job. I confirm that the git history is preserved via git mv (commit 41320c3). git log --follow <file> shows the file history before this PR. It's just that some files are very short and the syntax changes are too much to be considered by the GH web GUI as the same file.

@leofang leofang requested review from rwgk, rparolin and kkraus14 August 25, 2025 04:32
@leofang leofang marked this pull request as ready for review August 25, 2025 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda.bindings Everything related to the cuda.bindings module cuda.core Everything related to the cuda.core module documentation Improvements or additions to documentation P0 High priority - Must do!
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Convert all markdown files under cuda_*/docs/ to Sphinx ReST files
2 participants