[clang] [docs][clang-format] Rename clang-format docs *.rst -> *.md, update refs (PR #211397)
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 3 09:53:28 PDT 2026
https://github.com/rnk updated https://github.com/llvm/llvm-project/pull/211397
>From 98b3781f4c268f06eb0444d51d9ac6617c7b505b Mon Sep 17 00:00:00 2001
From: Reid Kleckner <rkleckner at nvidia.com>
Date: Mon, 20 Jul 2026 16:04:36 +0000
Subject: [PATCH 1/2] [docs][clang-format] Rename docs to Markdown
Rename ClangFormat and ClangFormatStyleOptions from reStructuredText to Markdown.
Update the clang-format documentation generator scripts and CMake custom targets to point at the renamed .md files so the generated documentation paths remain valid. Keep this changeset limited to rename/path updates; Markdown content cleanup is in the follow-up rewrite changeset.
---
clang/docs/{ClangFormat.rst => ClangFormat.md} | 0
...ClangFormatStyleOptions.rst => ClangFormatStyleOptions.md} | 0
clang/docs/tools/dump_format_help.py | 4 ++--
clang/docs/tools/dump_format_style.py | 4 ++--
clang/lib/Format/CMakeLists.txt | 4 ++--
clang/test/Format/docs_updated.test | 4 ++--
6 files changed, 8 insertions(+), 8 deletions(-)
rename clang/docs/{ClangFormat.rst => ClangFormat.md} (100%)
rename clang/docs/{ClangFormatStyleOptions.rst => ClangFormatStyleOptions.md} (100%)
diff --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.md
similarity index 100%
rename from clang/docs/ClangFormat.rst
rename to clang/docs/ClangFormat.md
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.md
similarity index 100%
rename from clang/docs/ClangFormatStyleOptions.rst
rename to clang/docs/ClangFormatStyleOptions.md
diff --git a/clang/docs/tools/dump_format_help.py b/clang/docs/tools/dump_format_help.py
index ba41ed8c02c81..7ef22dcad3a13 100755
--- a/clang/docs/tools/dump_format_help.py
+++ b/clang/docs/tools/dump_format_help.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# A tool to parse the output of `clang-format --help` and update the
-# documentation in ../ClangFormat.rst automatically.
+# documentation in ../ClangFormat.md automatically.
import argparse
import os
@@ -9,7 +9,7 @@
import sys
PARENT_DIR = os.path.join(os.path.dirname(__file__), "..")
-DOC_FILE = os.path.join(PARENT_DIR, "ClangFormat.rst")
+DOC_FILE = os.path.join(PARENT_DIR, "ClangFormat.md")
def substitute(text, tag, contents):
diff --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py
index 570a0cc6dde1d..a78c8f54045cc 100755
--- a/clang/docs/tools/dump_format_style.py
+++ b/clang/docs/tools/dump_format_style.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# A tool to parse the FormatStyle struct from Format.h and update the
-# documentation in ../ClangFormatStyleOptions.rst automatically.
+# documentation in ../ClangFormatStyleOptions.md automatically.
# Run from the directory in which this file is located to update the docs.
import argparse
@@ -16,7 +16,7 @@
INCLUDE_STYLE_FILE = os.path.join(
CLANG_DIR, "include/clang/Tooling/Inclusions/IncludeStyle.h"
)
-DOC_FILE = os.path.join(CLANG_DIR, "docs/ClangFormatStyleOptions.rst")
+DOC_FILE = os.path.join(CLANG_DIR, "docs/ClangFormatStyleOptions.md")
PLURALS_FILE = os.path.join(os.path.dirname(__file__), "plurals.txt")
diff --git a/clang/lib/Format/CMakeLists.txt b/clang/lib/Format/CMakeLists.txt
index 488732430862e..65369c8cd8278 100644
--- a/clang/lib/Format/CMakeLists.txt
+++ b/clang/lib/Format/CMakeLists.txt
@@ -67,7 +67,7 @@ set(docs_tools_dir ${CLANG_SOURCE_DIR}/docs/tools)
set(format_style_depend ${CMAKE_CURRENT_BINARY_DIR}/format_style_depend)
set(dump_style dump_format_style.py)
-set(style_options_rst ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst)
+set(style_options_rst ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.md)
add_custom_command(OUTPUT ${format_style_depend}
COMMAND ${Python3_EXECUTABLE} ${dump_style} && touch ${format_style_depend}
WORKING_DIRECTORY ${docs_tools_dir}
@@ -83,7 +83,7 @@ add_custom_target(clang-format-style DEPENDS ${format_style_depend})
set(format_help_depend ${CMAKE_CURRENT_BINARY_DIR}/format_help_depend)
set(dump_help dump_format_help.py)
-set(clang_format_rst ${CLANG_SOURCE_DIR}/docs/ClangFormat.rst)
+set(clang_format_rst ${CLANG_SOURCE_DIR}/docs/ClangFormat.md)
add_custom_command(OUTPUT ${format_help_depend}
COMMAND ${Python3_EXECUTABLE} ${dump_help} -d ${CMAKE_BINARY_DIR}/bin &&
touch ${format_help_depend}
diff --git a/clang/test/Format/docs_updated.test b/clang/test/Format/docs_updated.test
index 98d330e37ef45..c306f16def3e9 100644
--- a/clang/test/Format/docs_updated.test
+++ b/clang/test/Format/docs_updated.test
@@ -1,6 +1,6 @@
// RUN: %python %S/../../docs/tools/dump_format_style.py -o %t.style
// RUN: diff --strip-trailing-cr %t.style \
-// RUN: %S/../../docs/ClangFormatStyleOptions.rst
+// RUN: %S/../../docs/ClangFormatStyleOptions.md
// RUN: %python %S/../../docs/tools/dump_format_help.py -o %t.help
-// RUN: diff --strip-trailing-cr %t.help %S/../../docs/ClangFormat.rst
+// RUN: diff --strip-trailing-cr %t.help %S/../../docs/ClangFormat.md
>From 86f5613fd3046b38f732514ba108af00108917fb Mon Sep 17 00:00:00 2001
From: Reid Kleckner <rkleckner at nvidia.com>
Date: Mon, 3 Aug 2026 09:53:15 -0700
Subject: [PATCH 2/2] Apply suggestions from code review
Co-authored-by: owenca <owenpiano at gmail.com>
Co-authored-by: Reid Kleckner <rkleckner at nvidia.com>
---
clang/lib/Format/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Format/CMakeLists.txt b/clang/lib/Format/CMakeLists.txt
index 65369c8cd8278..272c8fcfa8477 100644
--- a/clang/lib/Format/CMakeLists.txt
+++ b/clang/lib/Format/CMakeLists.txt
@@ -67,7 +67,7 @@ set(docs_tools_dir ${CLANG_SOURCE_DIR}/docs/tools)
set(format_style_depend ${CMAKE_CURRENT_BINARY_DIR}/format_style_depend)
set(dump_style dump_format_style.py)
-set(style_options_rst ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.md)
+set(style_options_md ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.md)
add_custom_command(OUTPUT ${format_style_depend}
COMMAND ${Python3_EXECUTABLE} ${dump_style} && touch ${format_style_depend}
WORKING_DIRECTORY ${docs_tools_dir}
@@ -83,7 +83,7 @@ add_custom_target(clang-format-style DEPENDS ${format_style_depend})
set(format_help_depend ${CMAKE_CURRENT_BINARY_DIR}/format_help_depend)
set(dump_help dump_format_help.py)
-set(clang_format_rst ${CLANG_SOURCE_DIR}/docs/ClangFormat.md)
+set(clang_format_md ${CLANG_SOURCE_DIR}/docs/ClangFormat.md)
add_custom_command(OUTPUT ${format_help_depend}
COMMAND ${Python3_EXECUTABLE} ${dump_help} -d ${CMAKE_BINARY_DIR}/bin &&
touch ${format_help_depend}
More information about the cfe-commits
mailing list